From fa355086a40e6552d15a76dd7bfe979188a1fcf0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 9 Oct 2023 02:27:16 +0000 Subject: [PATCH] CodeGen from PR 17666 in Azure/azure-rest-api-specs Merge 68714be2680d2d993d24582080aba9cfbfc495d4 into 663ea6835c33bca216b63f777227db6a459a06b3 --- .../azure-mgmt-devtestlabs/_meta.json | 10 +- .../azure/mgmt/devtestlabs/__init__.py | 2 +- .../azure/mgmt/devtestlabs/_configuration.py | 17 +- .../mgmt/devtestlabs/_dev_test_labs_client.py | 41 +- .../azure/mgmt/devtestlabs/_serialization.py | 206 +- .../azure/mgmt/devtestlabs/_vendor.py | 11 - .../azure/mgmt/devtestlabs/_version.py | 2 +- .../azure/mgmt/devtestlabs/aio/__init__.py | 2 +- .../mgmt/devtestlabs/aio/_configuration.py | 12 +- .../devtestlabs/aio/_dev_test_labs_client.py | 34 +- .../devtestlabs/aio/operations/__init__.py | 12 +- .../operations/_arm_templates_operations.py | 53 +- .../_artifact_sources_operations.py | 146 +- .../aio/operations/_artifacts_operations.py | 86 +- .../operations/_bastion_hosts_operations.py | 626 + .../aio/operations/_costs_operations.py | 271 - .../operations/_custom_images_operations.py | 199 +- .../aio/operations/_disks_operations.py | 297 +- .../operations/_environments_operations.py | 192 +- .../aio/operations/_formulas_operations.py | 175 +- .../operations/_gallery_images_operations.py | 101 +- .../_global_schedules_operations.py | 270 +- .../aio/operations/_lab_secrets_operations.py | 763 ++ .../aio/operations/_labs_operations.py | 550 +- .../_notification_channels_operations.py | 176 +- .../devtestlabs/aio/operations/_operations.py | 32 +- .../aio/operations/_policies_operations.py | 137 +- .../aio/operations/_policy_sets_operations.py | 143 +- .../_provider_operations_operations.py | 24 +- .../aio/operations/_schedules_operations.py | 218 +- .../aio/operations/_secrets_operations.py | 162 +- .../_service_fabric_schedules_operations.py | 187 +- .../operations/_service_fabrics_operations.py | 318 +- .../operations/_service_runners_operations.py | 303 +- .../_shared_galleries_operations.py | 548 + .../operations/_shared_images_operations.py | 578 + .../aio/operations/_users_operations.py | 226 +- .../_virtual_machine_schedules_operations.py | 187 +- .../_virtual_machines_operations.py | 886 +- .../_virtual_networks_operations.py | 200 +- .../azure/mgmt/devtestlabs/models/__init__.py | 130 +- .../models/_dev_test_labs_client_enums.py | 96 +- .../mgmt/devtestlabs/models/_models_py3.py | 10536 ++++++++++++---- .../mgmt/devtestlabs/operations/__init__.py | 12 +- .../operations/_arm_templates_operations.py | 97 +- .../_artifact_sources_operations.py | 212 +- .../operations/_artifacts_operations.py | 153 +- .../operations/_bastion_hosts_operations.py | 859 ++ .../operations/_costs_operations.py | 349 - .../operations/_custom_images_operations.py | 263 +- .../operations/_disks_operations.py | 388 +- .../operations/_environments_operations.py | 256 +- .../operations/_formulas_operations.py | 240 +- .../operations/_gallery_images_operations.py | 148 +- .../_global_schedules_operations.py | 336 +- .../operations/_lab_secrets_operations.py | 948 ++ .../operations/_labs_operations.py | 682 +- .../_notification_channels_operations.py | 256 +- .../devtestlabs/operations/_operations.py | 44 +- .../operations/_policies_operations.py | 203 +- .../operations/_policy_sets_operations.py | 204 +- .../_provider_operations_operations.py | 26 +- .../operations/_schedules_operations.py | 307 +- .../operations/_secrets_operations.py | 227 +- .../_service_fabric_schedules_operations.py | 264 +- .../operations/_service_fabrics_operations.py | 416 +- .../operations/_service_runners_operations.py | 386 +- .../_shared_galleries_operations.py | 753 ++ .../operations/_shared_images_operations.py | 790 ++ .../operations/_users_operations.py | 290 +- .../_virtual_machine_schedules_operations.py | 318 +- .../_virtual_machines_operations.py | 1138 +- .../_virtual_networks_operations.py | 264 +- .../generated_samples/arm_templates_get.py | 8 +- .../generated_samples/arm_templates_list.py | 8 +- .../artifact_sources_create_or_update.py | 13 +- .../artifact_sources_delete.py | 11 +- .../generated_samples/artifact_sources_get.py | 8 +- .../artifact_sources_list.py | 6 +- .../artifact_sources_update.py | 8 +- .../artifacts_generate_arm_template.py | 8 +- .../generated_samples/artifacts_get.py | 8 +- .../generated_samples/artifacts_list.py | 8 +- .../generated_samples/bastion_hosts_delete.py | 42 + .../generated_samples/bastion_hosts_get.py | 43 + .../generated_samples/bastion_hosts_list.py | 43 + .../generated_samples/bastion_hosts_update.py | 43 + .../costs_create_or_update.py | 88 - .../custom_images_create_or_update.py | 9 +- .../generated_samples/custom_images_delete.py | 9 +- .../generated_samples/custom_images_get.py | 6 +- .../generated_samples/custom_images_list.py | 6 +- .../generated_samples/custom_images_update.py | 6 +- .../generated_samples/disks_attach.py | 9 +- .../disks_create_or_update.py | 11 +- .../generated_samples/disks_delete.py | 9 +- .../generated_samples/disks_detach.py | 9 +- .../generated_samples/disks_get.py | 6 +- .../generated_samples/disks_list.py | 6 +- .../generated_samples/disks_update.py | 6 +- .../environments_create_or_update.py | 11 +- .../generated_samples/environments_delete.py | 9 +- .../generated_samples/environments_get.py | 6 +- .../generated_samples/environments_list.py | 6 +- .../generated_samples/environments_update.py | 6 +- .../formulas_create_or_update.py | 12 +- .../generated_samples/formulas_delete.py | 9 +- .../generated_samples/formulas_get.py | 6 +- .../generated_samples/formulas_list.py | 6 +- .../generated_samples/formulas_update.py | 6 +- .../generated_samples/gallery_images_get.py | 42 + .../generated_samples/gallery_images_list.py | 6 +- .../global_schedules_create_or_update.py | 7 +- .../global_schedules_delete.py | 7 +- .../global_schedules_execute.py | 7 +- .../generated_samples/global_schedules_get.py | 4 +- ...global_schedules_list_by_resource_group.py | 4 +- .../global_schedules_list_by_subscription.py | 4 +- .../global_schedules_retarget.py | 7 +- .../global_schedules_update.py | 4 +- .../lab_secrets_create_or_update.py | 51 + .../generated_samples/lab_secrets_delete.py | 41 + .../{costs_get.py => lab_secrets_get.py} | 12 +- .../generated_samples/lab_secrets_list.py | 42 + .../generated_samples/lab_secrets_update.py | 42 + .../generated_samples/labs_claim_any_vm.py | 9 +- .../labs_create_environment.py | 11 +- .../labs_create_or_update.py | 12 +- .../generated_samples/labs_delete.py | 9 +- .../labs_ensure_current_user_profile.py | 40 + .../labs_export_resource_usage.py | 9 +- .../labs_generate_upload_uri.py | 6 +- .../generated_samples/labs_get.py | 6 +- .../labs_import_virtual_machine.py | 9 +- .../labs_list_by_resource_group.py | 4 +- .../labs_list_by_subscription.py | 4 +- .../generated_samples/labs_list_vhds.py | 6 +- .../generated_samples/labs_update.py | 6 +- .../notification_channels_create_or_update.py | 9 +- .../notification_channels_delete.py | 9 +- .../notification_channels_get.py | 6 +- .../notification_channels_list.py | 6 +- .../notification_channels_notify.py | 9 +- .../notification_channels_update.py | 6 +- .../generated_samples/operations_get.py | 6 +- .../policies_create_or_update.py | 6 +- .../generated_samples/policies_delete.py | 9 +- .../generated_samples/policies_get.py | 6 +- .../generated_samples/policies_list.py | 6 +- .../generated_samples/policies_update.py | 6 +- .../policy_sets_evaluate_policies.py | 6 +- .../generated_samples/policy_sets_list.py | 42 + .../provider_operations_list.py | 2 +- .../schedules_create_or_update.py | 8 +- .../generated_samples/schedules_delete.py | 9 +- .../generated_samples/schedules_execute.py | 9 +- .../generated_samples/schedules_get.py | 6 +- .../generated_samples/schedules_list.py | 6 +- .../schedules_list_applicable.py | 6 +- .../generated_samples/schedules_update.py | 6 +- .../secrets_create_or_update.py | 8 +- .../generated_samples/secrets_delete.py | 9 +- .../generated_samples/secrets_get.py | 6 +- .../generated_samples/secrets_list.py | 6 +- .../generated_samples/secrets_update.py | 6 +- ...rvice_fabric_schedules_create_or_update.py | 8 +- .../service_fabric_schedules_delete.py | 9 +- .../service_fabric_schedules_execute.py | 9 +- .../service_fabric_schedules_get.py | 6 +- .../service_fabric_schedules_list.py | 6 +- .../service_fabric_schedules_update.py | 6 +- .../service_fabrics_create_or_update.py | 6 +- .../service_fabrics_delete.py | 9 +- .../generated_samples/service_fabrics_get.py | 6 +- .../generated_samples/service_fabrics_list.py | 6 +- ...rvice_fabrics_list_applicable_schedules.py | 6 +- .../service_fabrics_start.py | 9 +- .../generated_samples/service_fabrics_stop.py | 9 +- .../service_fabrics_update.py | 6 +- .../service_runners_create_or_update.py | 7 +- .../service_runners_delete.py | 11 +- .../generated_samples/service_runners_get.py | 6 +- .../generated_samples/service_runners_list.py | 42 + .../shared_galleries_create_or_update.py | 50 + .../shared_galleries_delete.py | 41 + .../generated_samples/shared_galleries_get.py | 42 + .../shared_galleries_list.py | 42 + .../shared_galleries_update.py | 42 + .../shared_images_create_or_update.py | 54 + .../generated_samples/shared_images_delete.py | 42 + .../generated_samples/shared_images_get.py | 43 + .../generated_samples/shared_images_list.py | 43 + .../generated_samples/shared_images_update.py | 43 + .../users_create_or_update.py | 20 +- .../generated_samples/users_delete.py | 9 +- .../generated_samples/users_get.py | 6 +- .../generated_samples/users_list.py | 6 +- .../generated_samples/users_update.py | 6 +- ...tual_machine_schedules_create_or_update.py | 10 +- .../virtual_machine_schedules_delete.py | 11 +- .../virtual_machine_schedules_execute.py | 11 +- .../virtual_machine_schedules_get.py | 8 +- .../virtual_machine_schedules_list.py | 8 +- .../virtual_machine_schedules_update.py | 8 +- .../virtual_machines_add_data_disk.py | 9 +- .../virtual_machines_apply_artifacts.py | 9 +- .../virtual_machines_claim.py | 9 +- ...virtual_machines_clear_artifact_results.py | 41 + .../virtual_machines_create_or_update.py | 10 +- .../virtual_machines_delete.py | 9 +- .../virtual_machines_detach_data_disk.py | 9 +- .../generated_samples/virtual_machines_get.py | 6 +- .../virtual_machines_get_rdp_file_contents.py | 6 +- .../virtual_machines_list.py | 6 +- ...tual_machines_list_applicable_schedules.py | 6 +- .../virtual_machines_redeploy.py | 9 +- .../virtual_machines_resize.py | 9 +- .../virtual_machines_restart.py | 9 +- .../virtual_machines_start.py | 9 +- .../virtual_machines_stop.py | 9 +- .../virtual_machines_transfer_disks.py | 9 +- .../virtual_machines_un_claim.py | 9 +- .../virtual_machines_update.py | 6 +- .../virtual_networks_create_or_update.py | 10 +- .../virtual_networks_delete.py | 11 +- .../generated_samples/virtual_networks_get.py | 8 +- .../virtual_networks_list.py | 6 +- .../virtual_networks_update.py | 8 +- 228 files changed, 23220 insertions(+), 8862 deletions(-) create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_bastion_hosts_operations.py delete mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_costs_operations.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_lab_secrets_operations.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_shared_galleries_operations.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_shared_images_operations.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_bastion_hosts_operations.py delete mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_costs_operations.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_lab_secrets_operations.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_shared_galleries_operations.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_shared_images_operations.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_delete.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_get.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_list.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_update.py delete mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/costs_create_or_update.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/gallery_images_get.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_create_or_update.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_delete.py rename sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/{costs_get.py => lab_secrets_get.py} (83%) create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_list.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_update.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_ensure_current_user_profile.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policy_sets_list.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_list.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_create_or_update.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_delete.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_get.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_list.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_update.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_create_or_update.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_delete.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_get.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_list.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_update.py create mode 100644 sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_clear_artifact_results.py diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/_meta.json b/sdk/devtestlabs/azure-mgmt-devtestlabs/_meta.json index 6ed8248f7aa3..3cfc39b8b628 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/_meta.json +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/_meta.json @@ -1,11 +1,11 @@ { - "commit": "9685ef961fe7931fccdd9bf86afac8bca0b3ae88", + "commit": "d8852f7ddd54174cb6de4fb936874e65b7035d3d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.1", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/devtestlabs/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/devtestlabs/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/devtestlabs/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/__init__.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/__init__.py index 0501481d1dd7..f8340668009b 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/__init__.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_configuration.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_configuration.py index dbb78c1fa93f..bcdbac54da40 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_configuration.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -33,16 +27,16 @@ class DevTestLabsClientConfiguration(Configuration): # pylint: disable=too-many :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-09-15". Note that overriding this + :keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DevTestLabsClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-09-15") # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", "2021-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-devtestlabs/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + 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) diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_dev_test_labs_client.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_dev_test_labs_client.py index be2b029c11ce..f80cd9c83e89 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_dev_test_labs_client.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_dev_test_labs_client.py @@ -12,20 +12,21 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import DevTestLabsClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( ArmTemplatesOperations, ArtifactSourcesOperations, ArtifactsOperations, - CostsOperations, + BastionHostsOperations, CustomImagesOperations, DisksOperations, EnvironmentsOperations, FormulasOperations, GalleryImagesOperations, GlobalSchedulesOperations, + LabSecretsOperations, LabsOperations, NotificationChannelsOperations, Operations, @@ -37,6 +38,8 @@ ServiceFabricSchedulesOperations, ServiceFabricsOperations, ServiceRunnersOperations, + SharedGalleriesOperations, + SharedImagesOperations, UsersOperations, VirtualMachineSchedulesOperations, VirtualMachinesOperations, @@ -65,8 +68,6 @@ class DevTestLabsClient: # pylint: disable=client-accepts-api-version-keyword,t :vartype arm_templates: azure.mgmt.devtestlabs.operations.ArmTemplatesOperations :ivar artifacts: ArtifactsOperations operations :vartype artifacts: azure.mgmt.devtestlabs.operations.ArtifactsOperations - :ivar costs: CostsOperations operations - :vartype costs: azure.mgmt.devtestlabs.operations.CostsOperations :ivar custom_images: CustomImagesOperations operations :vartype custom_images: azure.mgmt.devtestlabs.operations.CustomImagesOperations :ivar formulas: FormulasOperations operations @@ -82,8 +83,14 @@ class DevTestLabsClient: # pylint: disable=client-accepts-api-version-keyword,t :vartype policies: azure.mgmt.devtestlabs.operations.PoliciesOperations :ivar schedules: SchedulesOperations operations :vartype schedules: azure.mgmt.devtestlabs.operations.SchedulesOperations + :ivar lab_secrets: LabSecretsOperations operations + :vartype lab_secrets: azure.mgmt.devtestlabs.operations.LabSecretsOperations :ivar service_runners: ServiceRunnersOperations operations :vartype service_runners: azure.mgmt.devtestlabs.operations.ServiceRunnersOperations + :ivar shared_galleries: SharedGalleriesOperations operations + :vartype shared_galleries: azure.mgmt.devtestlabs.operations.SharedGalleriesOperations + :ivar shared_images: SharedImagesOperations operations + :vartype shared_images: azure.mgmt.devtestlabs.operations.SharedImagesOperations :ivar users: UsersOperations operations :vartype users: azure.mgmt.devtestlabs.operations.UsersOperations :ivar disks: DisksOperations operations @@ -104,13 +111,15 @@ class DevTestLabsClient: # pylint: disable=client-accepts-api-version-keyword,t azure.mgmt.devtestlabs.operations.VirtualMachineSchedulesOperations :ivar virtual_networks: VirtualNetworksOperations operations :vartype virtual_networks: azure.mgmt.devtestlabs.operations.VirtualNetworksOperations + :ivar bastion_hosts: BastionHostsOperations operations + :vartype bastion_hosts: azure.mgmt.devtestlabs.operations.BastionHostsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2018-09-15". Note that overriding this + :keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -125,9 +134,9 @@ def __init__( **kwargs: Any ) -> None: self._config = DevTestLabsClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -144,7 +153,6 @@ def __init__( ) self.arm_templates = ArmTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) self.artifacts = ArtifactsOperations(self._client, self._config, self._serialize, self._deserialize) - self.costs = CostsOperations(self._client, self._config, self._serialize, self._deserialize) self.custom_images = CustomImagesOperations(self._client, self._config, self._serialize, self._deserialize) self.formulas = FormulasOperations(self._client, self._config, self._serialize, self._deserialize) self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) @@ -154,7 +162,12 @@ def __init__( self.policy_sets = PolicySetsOperations(self._client, self._config, self._serialize, self._deserialize) self.policies = PoliciesOperations(self._client, self._config, self._serialize, self._deserialize) self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.lab_secrets = LabSecretsOperations(self._client, self._config, self._serialize, self._deserialize) self.service_runners = ServiceRunnersOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_galleries = SharedGalleriesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.shared_images = SharedImagesOperations(self._client, self._config, self._serialize, self._deserialize) self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) self.environments = EnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -172,6 +185,7 @@ def __init__( self.virtual_networks = VirtualNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) + self.bastion_hosts = BastionHostsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -195,15 +209,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> DevTestLabsClient + def __enter__(self) -> "DevTestLabsClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_serialization.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_serialization.py index 7c1dedb5133d..4bae2292227b 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_serialization.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,26 +645,26 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -659,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +699,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -718,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -726,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -780,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +869,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -866,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -878,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -925,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1001,10 +1036,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1371,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1452,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1480,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1579,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1601,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1783,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1834,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1846,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1862,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1877,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1907,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1922,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1937,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1960,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1996,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_vendor.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_vendor.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_version.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_version.py index 79aaa33e5e04..c47f66669f1b 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_version.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0b1" +VERSION = "1.0.0" diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/__init__.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/__init__.py index 9b937368c67d..c1da859932b1 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/__init__.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_configuration.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_configuration.py index 92c6b4daadbd..f8fb1fd62572 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_configuration.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -33,16 +27,16 @@ class DevTestLabsClientConfiguration(Configuration): # pylint: disable=too-many :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-09-15". Note that overriding this + :keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DevTestLabsClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-09-15") # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", "2021-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_dev_test_labs_client.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_dev_test_labs_client.py index 1cd3385cce5b..80acfcf59165 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_dev_test_labs_client.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_dev_test_labs_client.py @@ -12,20 +12,21 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import DevTestLabsClientConfiguration from .operations import ( ArmTemplatesOperations, ArtifactSourcesOperations, ArtifactsOperations, - CostsOperations, + BastionHostsOperations, CustomImagesOperations, DisksOperations, EnvironmentsOperations, FormulasOperations, GalleryImagesOperations, GlobalSchedulesOperations, + LabSecretsOperations, LabsOperations, NotificationChannelsOperations, Operations, @@ -37,6 +38,8 @@ ServiceFabricSchedulesOperations, ServiceFabricsOperations, ServiceRunnersOperations, + SharedGalleriesOperations, + SharedImagesOperations, UsersOperations, VirtualMachineSchedulesOperations, VirtualMachinesOperations, @@ -66,8 +69,6 @@ class DevTestLabsClient: # pylint: disable=client-accepts-api-version-keyword,t :vartype arm_templates: azure.mgmt.devtestlabs.aio.operations.ArmTemplatesOperations :ivar artifacts: ArtifactsOperations operations :vartype artifacts: azure.mgmt.devtestlabs.aio.operations.ArtifactsOperations - :ivar costs: CostsOperations operations - :vartype costs: azure.mgmt.devtestlabs.aio.operations.CostsOperations :ivar custom_images: CustomImagesOperations operations :vartype custom_images: azure.mgmt.devtestlabs.aio.operations.CustomImagesOperations :ivar formulas: FormulasOperations operations @@ -83,8 +84,14 @@ class DevTestLabsClient: # pylint: disable=client-accepts-api-version-keyword,t :vartype policies: azure.mgmt.devtestlabs.aio.operations.PoliciesOperations :ivar schedules: SchedulesOperations operations :vartype schedules: azure.mgmt.devtestlabs.aio.operations.SchedulesOperations + :ivar lab_secrets: LabSecretsOperations operations + :vartype lab_secrets: azure.mgmt.devtestlabs.aio.operations.LabSecretsOperations :ivar service_runners: ServiceRunnersOperations operations :vartype service_runners: azure.mgmt.devtestlabs.aio.operations.ServiceRunnersOperations + :ivar shared_galleries: SharedGalleriesOperations operations + :vartype shared_galleries: azure.mgmt.devtestlabs.aio.operations.SharedGalleriesOperations + :ivar shared_images: SharedImagesOperations operations + :vartype shared_images: azure.mgmt.devtestlabs.aio.operations.SharedImagesOperations :ivar users: UsersOperations operations :vartype users: azure.mgmt.devtestlabs.aio.operations.UsersOperations :ivar disks: DisksOperations operations @@ -105,13 +112,15 @@ class DevTestLabsClient: # pylint: disable=client-accepts-api-version-keyword,t azure.mgmt.devtestlabs.aio.operations.VirtualMachineSchedulesOperations :ivar virtual_networks: VirtualNetworksOperations operations :vartype virtual_networks: azure.mgmt.devtestlabs.aio.operations.VirtualNetworksOperations + :ivar bastion_hosts: BastionHostsOperations operations + :vartype bastion_hosts: azure.mgmt.devtestlabs.aio.operations.BastionHostsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2018-09-15". Note that overriding this + :keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -126,9 +135,9 @@ def __init__( **kwargs: Any ) -> None: self._config = DevTestLabsClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -145,7 +154,6 @@ def __init__( ) self.arm_templates = ArmTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) self.artifacts = ArtifactsOperations(self._client, self._config, self._serialize, self._deserialize) - self.costs = CostsOperations(self._client, self._config, self._serialize, self._deserialize) self.custom_images = CustomImagesOperations(self._client, self._config, self._serialize, self._deserialize) self.formulas = FormulasOperations(self._client, self._config, self._serialize, self._deserialize) self.gallery_images = GalleryImagesOperations(self._client, self._config, self._serialize, self._deserialize) @@ -155,7 +163,12 @@ def __init__( self.policy_sets = PolicySetsOperations(self._client, self._config, self._serialize, self._deserialize) self.policies = PoliciesOperations(self._client, self._config, self._serialize, self._deserialize) self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.lab_secrets = LabSecretsOperations(self._client, self._config, self._serialize, self._deserialize) self.service_runners = ServiceRunnersOperations(self._client, self._config, self._serialize, self._deserialize) + self.shared_galleries = SharedGalleriesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.shared_images = SharedImagesOperations(self._client, self._config, self._serialize, self._deserialize) self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize) self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize) self.environments = EnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -173,6 +186,7 @@ def __init__( self.virtual_networks = VirtualNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) + self.bastion_hosts = BastionHostsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -203,5 +217,5 @@ async def __aenter__(self) -> "DevTestLabsClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/__init__.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/__init__.py index 7ccc7d9fe973..0d81106f3328 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/__init__.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/__init__.py @@ -13,7 +13,6 @@ from ._artifact_sources_operations import ArtifactSourcesOperations from ._arm_templates_operations import ArmTemplatesOperations from ._artifacts_operations import ArtifactsOperations -from ._costs_operations import CostsOperations from ._custom_images_operations import CustomImagesOperations from ._formulas_operations import FormulasOperations from ._gallery_images_operations import GalleryImagesOperations @@ -21,7 +20,10 @@ from ._policy_sets_operations import PolicySetsOperations from ._policies_operations import PoliciesOperations from ._schedules_operations import SchedulesOperations +from ._lab_secrets_operations import LabSecretsOperations from ._service_runners_operations import ServiceRunnersOperations +from ._shared_galleries_operations import SharedGalleriesOperations +from ._shared_images_operations import SharedImagesOperations from ._users_operations import UsersOperations from ._disks_operations import DisksOperations from ._environments_operations import EnvironmentsOperations @@ -31,9 +33,10 @@ from ._virtual_machines_operations import VirtualMachinesOperations from ._virtual_machine_schedules_operations import VirtualMachineSchedulesOperations from ._virtual_networks_operations import VirtualNetworksOperations +from ._bastion_hosts_operations import BastionHostsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -44,7 +47,6 @@ "ArtifactSourcesOperations", "ArmTemplatesOperations", "ArtifactsOperations", - "CostsOperations", "CustomImagesOperations", "FormulasOperations", "GalleryImagesOperations", @@ -52,7 +54,10 @@ "PolicySetsOperations", "PoliciesOperations", "SchedulesOperations", + "LabSecretsOperations", "ServiceRunnersOperations", + "SharedGalleriesOperations", + "SharedImagesOperations", "UsersOperations", "DisksOperations", "EnvironmentsOperations", @@ -62,6 +67,7 @@ "VirtualMachinesOperations", "VirtualMachineSchedulesOperations", "VirtualNetworksOperations", + "BastionHostsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_arm_templates_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_arm_templates_operations.py index ed06baf5f455..09f06adde000 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_arm_templates_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_arm_templates_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._arm_templates_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +67,8 @@ def list( ) -> AsyncIterable["_models.ArmTemplate"]: """List azure resource manager templates in a given artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -81,8 +77,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=displayName)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -98,10 +94,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArmTemplateList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArmTemplateList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,7 +123,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -145,7 +139,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -153,14 +147,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArmTemplateList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,7 +167,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates" + } @distributed_trace_async async def get( @@ -186,7 +183,8 @@ async def get( ) -> _models.ArmTemplate: """Get azure resource manager template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -213,10 +211,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArmTemplate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArmTemplate] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -231,10 +227,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,4 +247,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifact_sources_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifact_sources_operations.py index 808c638394d5..0153f68a87e6 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifact_sources_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifact_sources_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +37,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,15 +73,16 @@ def list( ) -> AsyncIterable["_models.ArtifactSource"]: """List artifact sources in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=displayName)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -101,10 +98,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactSourceList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArtifactSourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -131,7 +126,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -147,7 +142,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,14 +150,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArtifactSourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,7 +170,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources" + } @distributed_trace_async async def get( @@ -182,7 +180,8 @@ async def get( ) -> _models.ArtifactSource: """Get artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -207,10 +206,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactSource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArtifactSource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -224,10 +221,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -243,7 +241,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}" + } @overload async def create_or_update( @@ -258,7 +258,8 @@ async def create_or_update( ) -> _models.ArtifactSource: """Create or replace an existing artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -288,7 +289,8 @@ async def create_or_update( ) -> _models.ArtifactSource: """Create or replace an existing artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -316,14 +318,15 @@ async def create_or_update( ) -> _models.ArtifactSource: """Create or replace an existing artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the artifact source. Required. :type name: str - :param artifact_source: Properties of an artifact source. Is either a model type or a IO type. - Required. + :param artifact_source: Properties of an artifact source. Is either a ArtifactSource type or a + IO type. Required. :type artifact_source: ~azure.mgmt.devtestlabs.models.ArtifactSource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -344,16 +347,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactSource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ArtifactSource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(artifact_source, (IO, bytes)): + if isinstance(artifact_source, (IOBase, bytes)): _content = artifact_source else: _json = self._serialize.body(artifact_source, "ArtifactSource") @@ -372,10 +373,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -391,11 +393,13 @@ async def create_or_update( deserialized = self._deserialize("ArtifactSource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -403,7 +407,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -425,10 +430,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -441,10 +444,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -456,15 +460,24 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.ArtifactSource: """Allows modifying tags of artifact sources. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -472,6 +485,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: ArtifactSource or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.ArtifactSource @@ -488,13 +503,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactSource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.ArtifactSource] = kwargs.pop("cls", None) - _artifact_source = _models.ArtifactSourceFragment(tags=tags) + _artifact_source = _models.ArtifactSourceFragment(identity=identity, tags=tags) _json = self._serialize.body(_artifact_source, "ArtifactSourceFragment") request = build_update_request( @@ -510,10 +523,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,4 +543,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifacts_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifacts_operations.py index c47fa1be7e67..391e772a5293 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifacts_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_artifacts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -35,10 +35,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +72,8 @@ def list( ) -> AsyncIterable["_models.Artifact"]: """List artifacts in a given artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -85,8 +82,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=title)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -102,10 +99,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArtifactList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ArtifactList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +172,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts" + } @distributed_trace_async async def get( @@ -190,7 +188,8 @@ async def get( ) -> _models.Artifact: """Get artifact. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -217,10 +216,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Artifact] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Artifact] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -235,10 +232,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -254,7 +252,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}" + } @overload async def generate_arm_template( @@ -271,7 +271,8 @@ async def generate_arm_template( """Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -306,7 +307,8 @@ async def generate_arm_template( """Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -339,7 +341,8 @@ async def generate_arm_template( """Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -348,7 +351,7 @@ async def generate_arm_template( :param name: The name of the artifact. Required. :type name: str :param generate_arm_template_request: Parameters for generating an ARM template for deploying - artifacts. Is either a model type or a IO type. Required. + artifacts. Is either a GenerateArmTemplateRequest type or a IO type. Required. :type generate_arm_template_request: ~azure.mgmt.devtestlabs.models.GenerateArmTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -370,16 +373,14 @@ async def generate_arm_template( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArmTemplateInfo] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ArmTemplateInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(generate_arm_template_request, (IO, bytes)): + if isinstance(generate_arm_template_request, (IOBase, bytes)): _content = generate_arm_template_request else: _json = self._serialize.body(generate_arm_template_request, "GenerateArmTemplateRequest") @@ -399,10 +400,11 @@ async def generate_arm_template( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,4 +420,6 @@ async def generate_arm_template( return deserialized - generate_arm_template.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate"} # type: ignore + generate_arm_template.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_bastion_hosts_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_bastion_hosts_operations.py new file mode 100644 index 000000000000..03d003399688 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_bastion_hosts_operations.py @@ -0,0 +1,626 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._bastion_hosts_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BastionHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devtestlabs.aio.DevTestLabsClient`'s + :attr:`bastion_hosts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.BastionHost"]: + """List bastionhosts in a given virtual network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionHost or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devtestlabs.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BastionHostList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BastionHostList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, **kwargs: Any + ) -> _models.BastionHost: + """Get bastionhost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param name: The name of the bastionhost. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BastionHost or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.BastionHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> _models.BastionHost: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + + _bastion_host = _models.BastionHost(location=location, tags=tags) + _json = self._serialize.body(_bastion_host, "BastionHost") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BastionHost", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BastionHost]: + """Create or replace an existing bastionHost. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param name: The name of the bastionhost. Required. + :type name: str + :param location: The geo-location where the resource lives. Required. + :type location: str + :param tags: Resource tags. Default value is None. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devtestlabs.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + location=location, + tags=tags, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BastionHost", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete bastionhost. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param name: The name of the bastionhost. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> _models.BastionHost: + """Allows modifying tags of bastionhosts. All other properties will be ignored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param name: The name of the bastionhost. Required. + :type name: str + :param tags: The tags of the resource. Default value is None. + :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BastionHost or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.BastionHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + + _bastion_host = _models.BastionHostFragment(identity=identity, tags=tags) + _json = self._serialize.body(_bastion_host, "BastionHostFragment") + + request = build_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_costs_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_costs_operations.py deleted file mode 100644 index 7c5ef813cd2e..000000000000 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_costs_operations.py +++ /dev/null @@ -1,271 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._costs_operations import build_create_or_update_request, build_get_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CostsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.devtestlabs.aio.DevTestLabsClient`'s - :attr:`costs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, lab_name: str, name: str, expand: Optional[str] = None, **kwargs: Any - ) -> _models.LabCost: - """Get cost. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the cost. Required. - :type name: str - :param expand: Specify the $expand query. Example: 'properties($expand=labCostDetails)'. - Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabCost or the result of cls(response) - :rtype: ~azure.mgmt.devtestlabs.models.LabCost - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabCost] - - request = build_get_request( - resource_group_name=resource_group_name, - lab_name=lab_name, - name=name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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("LabCost", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}"} # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - lab_name: str, - name: str, - lab_cost: _models.LabCost, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LabCost: - """Create or replace an existing cost. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the cost. Required. - :type name: str - :param lab_cost: A cost item. Required. - :type lab_cost: ~azure.mgmt.devtestlabs.models.LabCost - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabCost or the result of cls(response) - :rtype: ~azure.mgmt.devtestlabs.models.LabCost - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - lab_name: str, - name: str, - lab_cost: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LabCost: - """Create or replace an existing cost. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the cost. Required. - :type name: str - :param lab_cost: A cost item. Required. - :type lab_cost: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabCost or the result of cls(response) - :rtype: ~azure.mgmt.devtestlabs.models.LabCost - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, resource_group_name: str, lab_name: str, name: str, lab_cost: Union[_models.LabCost, IO], **kwargs: Any - ) -> _models.LabCost: - """Create or replace an existing cost. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the cost. Required. - :type name: str - :param lab_cost: A cost item. Is either a model type or a IO type. Required. - :type lab_cost: ~azure.mgmt.devtestlabs.models.LabCost or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabCost or the result of cls(response) - :rtype: ~azure.mgmt.devtestlabs.models.LabCost - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabCost] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(lab_cost, (IO, bytes)): - _content = lab_cost - else: - _json = self._serialize.body(lab_cost, "LabCost") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - lab_name=lab_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LabCost", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LabCost", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}"} # type: ignore diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_custom_images_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_custom_images_operations.py index b2ec21669c64..c2b0dd16c03f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_custom_images_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_custom_images_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,15 +75,16 @@ def list( ) -> AsyncIterable["_models.CustomImage"]: """List custom images in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=vm)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -103,10 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImageList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomImageList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomImageList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +172,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages" + } @distributed_trace_async async def get( @@ -184,7 +182,8 @@ async def get( ) -> _models.CustomImage: """Get custom image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -209,10 +208,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomImage] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -226,10 +223,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,7 +243,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } async def _create_or_update_initial( self, @@ -266,16 +266,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomImage] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_image, (IO, bytes)): + if isinstance(custom_image, (IOBase, bytes)): _content = custom_image else: _json = self._serialize.body(custom_image, "CustomImage") @@ -294,10 +292,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,11 +312,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("CustomImage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } @overload async def begin_create_or_update( @@ -332,7 +333,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomImage]: """Create or replace an existing custom image. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -370,7 +372,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomImage]: """Create or replace an existing custom image. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -406,13 +409,14 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomImage]: """Create or replace an existing custom image. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the custom image. Required. :type name: str - :param custom_image: A custom image. Is either a model type or a IO type. Required. + :param custom_image: A custom image. Is either a CustomImage type or a IO type. Required. :type custom_image: ~azure.mgmt.devtestlabs.models.CustomImage or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -433,16 +437,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImage] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomImage] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -463,7 +465,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -475,9 +480,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -493,10 +500,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -509,10 +514,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,10 +527,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } @distributed_trace_async async def begin_delete( @@ -532,7 +547,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete custom image. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -553,13 +569,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -578,7 +592,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -590,17 +607,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.CustomImage: """Allows modifying tags of custom images. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -608,6 +634,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomImage or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.CustomImage @@ -624,13 +652,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CustomImage] = kwargs.pop("cls", None) - _custom_image = _models.CustomImageFragment(tags=tags) + _custom_image = _models.CustomImageFragment(identity=identity, tags=tags) _json = self._serialize.body(_custom_image, "CustomImageFragment") request = build_update_request( @@ -646,10 +672,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,4 +692,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_disks_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_disks_operations.py index 1dc1ee6b322d..23a90ff42c62 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_disks_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_disks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +78,8 @@ def list( ) -> AsyncIterable["_models.Disk"]: """List disks in a given user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -91,8 +88,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=diskType)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -108,10 +105,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiskList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -139,7 +134,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -155,7 +150,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -163,14 +158,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,7 +178,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks" + } @distributed_trace_async async def get( @@ -196,7 +194,8 @@ async def get( ) -> _models.Disk: """Get disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -223,10 +222,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Disk] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -241,10 +238,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -260,7 +258,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } async def _create_or_update_initial( self, @@ -282,16 +282,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Disk] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk, (IO, bytes)): + if isinstance(disk, (IOBase, bytes)): _content = disk else: _json = self._serialize.body(disk, "Disk") @@ -311,10 +309,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -330,11 +329,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("Disk", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } @overload async def begin_create_or_update( @@ -350,7 +351,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Disk]: """Create or replace an existing disk. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -390,7 +392,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Disk]: """Create or replace an existing disk. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -428,7 +431,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Disk]: """Create or replace an existing disk. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -436,7 +440,7 @@ async def begin_create_or_update( :type user_name: str :param name: The name of the disk. Required. :type name: str - :param disk: A Disk. Is either a model type or a IO type. Required. + :param disk: A Disk. Is either a Disk type or a IO type. Required. :type disk: ~azure.mgmt.devtestlabs.models.Disk or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -456,16 +460,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Disk] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, user_name=user_name, @@ -487,7 +489,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -499,9 +501,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -517,10 +521,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -534,10 +536,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,10 +549,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } @distributed_trace_async async def begin_delete( @@ -557,7 +569,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete disk. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -580,13 +593,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -606,7 +617,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -618,9 +632,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } @distributed_trace_async async def update( @@ -630,11 +646,13 @@ async def update( user_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Disk: """Allows modifying tags of disks. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -644,6 +662,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Disk or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Disk @@ -660,13 +680,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Disk] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - _disk = _models.DiskFragment(tags=tags) + _disk = _models.DiskFragment(identity=identity, tags=tags) _json = self._serialize.body(_disk, "DiskFragment") request = build_update_request( @@ -683,10 +701,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -702,7 +721,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } async def _attach_initial( # pylint: disable=inconsistent-return-statements self, @@ -724,11 +745,9 @@ async def _attach_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _attach_disk_properties = _models.AttachDiskProperties(leased_by_lab_vm_id=leased_by_lab_vm_id) _json = self._serialize.body(_attach_disk_properties, "AttachDiskProperties") @@ -747,10 +766,11 @@ async def _attach_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,10 +779,19 @@ async def _attach_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _attach_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach"} # type: ignore + _attach_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach" + } @distributed_trace_async async def begin_attach( @@ -777,7 +806,8 @@ async def begin_attach( """Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -803,14 +833,12 @@ async def begin_attach( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._attach_initial( # type: ignore resource_group_name=resource_group_name, @@ -832,7 +860,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -844,9 +875,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_attach.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach"} # type: ignore + begin_attach.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach" + } async def _detach_initial( # pylint: disable=inconsistent-return-statements self, @@ -868,11 +901,9 @@ async def _detach_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _detach_disk_properties = _models.DetachDiskProperties(leased_by_lab_vm_id=leased_by_lab_vm_id) _json = self._serialize.body(_detach_disk_properties, "DetachDiskProperties") @@ -891,10 +922,11 @@ async def _detach_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -903,10 +935,19 @@ async def _detach_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _detach_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach"} # type: ignore + _detach_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach" + } @distributed_trace_async async def begin_detach( @@ -921,7 +962,8 @@ async def begin_detach( """Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -947,14 +989,12 @@ async def begin_detach( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._detach_initial( # type: ignore resource_group_name=resource_group_name, @@ -976,7 +1016,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -988,6 +1031,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_detach.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach"} # type: ignore + begin_detach.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_environments_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_environments_operations.py index 5696716c1159..135f194a7596 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_environments_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_environments_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +76,8 @@ def list( ) -> AsyncIterable["_models.DtlEnvironment"]: """List environments in a given user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -89,8 +86,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=deploymentProperties)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -106,10 +103,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironmentList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DtlEnvironmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -137,7 +132,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -153,7 +148,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -161,14 +156,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DtlEnvironmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,7 +176,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments" + } @distributed_trace_async async def get( @@ -194,7 +192,8 @@ async def get( ) -> _models.DtlEnvironment: """Get environment. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -221,10 +220,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DtlEnvironment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -239,10 +236,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -258,7 +256,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } async def _create_or_update_initial( self, @@ -280,16 +280,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DtlEnvironment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(dtl_environment, (IO, bytes)): + if isinstance(dtl_environment, (IOBase, bytes)): _content = dtl_environment else: _json = self._serialize.body(dtl_environment, "DtlEnvironment") @@ -309,10 +307,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -328,11 +327,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("DtlEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } @overload async def begin_create_or_update( @@ -348,7 +349,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.DtlEnvironment]: """Create or replace an existing environment. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -390,7 +392,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.DtlEnvironment]: """Create or replace an existing environment. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -430,7 +433,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.DtlEnvironment]: """Create or replace an existing environment. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -439,7 +443,7 @@ async def begin_create_or_update( :param name: The name of the environment. Required. :type name: str :param dtl_environment: An environment, which is essentially an ARM template deployment. Is - either a model type or a IO type. Required. + either a DtlEnvironment type or a IO type. Required. :type dtl_environment: ~azure.mgmt.devtestlabs.models.DtlEnvironment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -460,16 +464,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironment] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DtlEnvironment] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, user_name=user_name, @@ -491,7 +493,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -503,9 +508,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -521,10 +528,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -538,10 +543,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -550,10 +556,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } @distributed_trace_async async def begin_delete( @@ -561,7 +576,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete environment. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -584,13 +600,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -610,7 +624,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -622,9 +639,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } @distributed_trace_async async def update( @@ -634,11 +653,13 @@ async def update( user_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.DtlEnvironment: """Allows modifying tags of environments. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -648,6 +669,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: DtlEnvironment or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.DtlEnvironment @@ -664,13 +687,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DtlEnvironment] = kwargs.pop("cls", None) - _dtl_environment = _models.DtlEnvironmentFragment(tags=tags) + _dtl_environment = _models.DtlEnvironmentFragment(identity=identity, tags=tags) _json = self._serialize.body(_dtl_environment, "DtlEnvironmentFragment") request = build_update_request( @@ -687,10 +708,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -706,4 +728,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_formulas_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_formulas_operations.py index 46c29c369fe0..1764b6cb8063 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_formulas_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_formulas_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,15 +75,16 @@ def list( ) -> AsyncIterable["_models.Formula"]: """List formulas in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=description)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -103,10 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FormulaList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FormulaList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("FormulaList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +172,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas" + } @distributed_trace_async async def get( @@ -184,7 +182,8 @@ async def get( ) -> _models.Formula: """Get formula. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -209,10 +208,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Formula] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Formula] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -226,10 +223,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,7 +243,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } async def _create_or_update_initial( self, resource_group_name: str, lab_name: str, name: str, formula: Union[_models.Formula, IO], **kwargs: Any @@ -261,16 +261,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Formula] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Formula] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(formula, (IO, bytes)): + if isinstance(formula, (IOBase, bytes)): _content = formula else: _json = self._serialize.body(formula, "Formula") @@ -289,10 +287,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,11 +307,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("Formula", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } @overload async def begin_create_or_update( @@ -325,9 +326,10 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Formula]: - """Create or replace an existing formula. This operation can take a while to complete. + """Create or replace an existing Formula. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -364,9 +366,10 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Formula]: - """Create or replace an existing formula. This operation can take a while to complete. + """Create or replace an existing Formula. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -396,16 +399,17 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, lab_name: str, name: str, formula: Union[_models.Formula, IO], **kwargs: Any ) -> AsyncLROPoller[_models.Formula]: - """Create or replace an existing formula. This operation can take a while to complete. + """Create or replace an existing Formula. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the formula. Required. :type name: str :param formula: A formula for creating a VM, specifying an image base and other parameters. Is - either a model type or a IO type. Required. + either a Formula type or a IO type. Required. :type formula: ~azure.mgmt.devtestlabs.models.Formula or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -426,16 +430,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Formula] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Formula] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -456,7 +458,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -468,9 +473,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -478,7 +485,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete formula. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -500,10 +508,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +522,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -531,15 +538,24 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.Formula: """Allows modifying tags of formulas. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -547,6 +563,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Formula or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Formula @@ -563,13 +581,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Formula] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Formula] = kwargs.pop("cls", None) - _formula = _models.FormulaFragment(tags=tags) + _formula = _models.FormulaFragment(identity=identity, tags=tags) _json = self._serialize.body(_formula, "FormulaFragment") request = build_update_request( @@ -585,10 +601,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,4 +621,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_gallery_images_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_gallery_images_operations.py index 6d766486dacc..92a3aab86457 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_gallery_images_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_gallery_images_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -23,17 +22,14 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._gallery_images_operations import build_list_request +from ...operations._gallery_images_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,15 +66,16 @@ def list( ) -> AsyncIterable["_models.GalleryImage"]: """List gallery images in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=author)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -94,10 +91,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GalleryImageList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GalleryImageList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -124,7 +119,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -140,7 +135,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -148,14 +143,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -167,4 +163,71 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> _models.GalleryImage: + """Get gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the gallery image. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.GalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GalleryImage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_global_schedules_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_global_schedules_operations.py index 301884641c2f..0e2e9499313a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_global_schedules_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_global_schedules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -42,10 +42,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +79,8 @@ def list_by_subscription( :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -100,10 +96,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -128,7 +122,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -144,7 +138,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -152,14 +146,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,7 +166,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules"} @distributed_trace def list_by_resource_group( @@ -185,13 +180,14 @@ def list_by_resource_group( ) -> AsyncIterable["_models.Schedule"]: """List schedules in a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -207,10 +203,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -236,7 +230,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -252,7 +246,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -260,14 +254,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -279,7 +274,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules" + } @distributed_trace_async async def get( @@ -287,7 +284,8 @@ async def get( ) -> _models.Schedule: """Get schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -310,10 +308,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -326,10 +322,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,7 +342,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" + } @overload async def create_or_update( @@ -359,7 +358,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -386,7 +386,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -407,11 +408,12 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str - :param schedule: A schedule. Is either a model type or a IO type. Required. + :param schedule: A schedule. Is either a Schedule type or a IO type. Required. :type schedule: ~azure.mgmt.devtestlabs.models.Schedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -432,16 +434,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(schedule, (IO, bytes)): + if isinstance(schedule, (IOBase, bytes)): _content = schedule else: _json = self._serialize.body(schedule, "Schedule") @@ -459,10 +459,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -478,11 +479,13 @@ async def create_or_update( deserialized = self._deserialize("Schedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -490,7 +493,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -510,10 +514,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -525,10 +527,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,20 +543,30 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.Schedule: """Allows modifying tags of schedules. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Schedule @@ -570,13 +583,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _schedule = _models.ScheduleFragment(tags=tags) + _schedule = _models.ScheduleFragment(identity=identity, tags=tags) _json = self._serialize.body(_schedule, "ScheduleFragment") request = build_update_request( @@ -591,10 +602,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -610,7 +622,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" + } async def _execute_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -626,10 +640,8 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( resource_group_name=resource_group_name, @@ -641,10 +653,11 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -653,16 +666,26 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _execute_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute"} # type: ignore + _execute_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute" + } @distributed_trace_async async def begin_execute(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Execute a schedule. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -681,13 +704,11 @@ async def begin_execute(self, resource_group_name: str, name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._execute_initial( # type: ignore resource_group_name=resource_group_name, @@ -705,7 +726,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -717,9 +741,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_execute.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute"} # type: ignore + begin_execute.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute" + } async def _retarget_initial( # pylint: disable=inconsistent-return-statements self, @@ -740,11 +766,9 @@ async def _retarget_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _retarget_schedule_properties = _models.RetargetScheduleProperties( current_resource_id=current_resource_id, target_resource_id=target_resource_id @@ -763,10 +787,11 @@ async def _retarget_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -775,10 +800,19 @@ async def _retarget_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _retarget_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget"} # type: ignore + _retarget_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget" + } @distributed_trace_async async def begin_retarget( @@ -791,7 +825,8 @@ async def begin_retarget( ) -> AsyncLROPoller[None]: """Updates a schedule's target resource Id. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -816,14 +851,12 @@ async def begin_retarget( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._retarget_initial( # type: ignore resource_group_name=resource_group_name, @@ -844,7 +877,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -856,6 +892,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retarget.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget"} # type: ignore + begin_retarget.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_lab_secrets_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_lab_secrets_operations.py new file mode 100644 index 000000000000..6f315f9f26b4 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_lab_secrets_operations.py @@ -0,0 +1,763 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._lab_secrets_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LabSecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devtestlabs.aio.DevTestLabsClient`'s + :attr:`lab_secrets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.LabSecret"]: + """List lab secrets in a given lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LabSecret or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabSecretList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LabSecretList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> _models.LabSecret: + """Get lab secret. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LabSecret or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.LabSecret + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LabSecret", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + lab_name: str, + name: str, + lab_secret: Union[_models.LabSecret, IO], + **kwargs: Any + ) -> _models.LabSecret: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(lab_secret, (IOBase, bytes)): + _content = lab_secret + else: + _json = self._serialize.body(lab_secret, "LabSecret") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("LabSecret", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("LabSecret", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + lab_secret: _models.LabSecret, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LabSecret]: + """Create or replace an existing Lab Secret. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :param lab_secret: A shared secret in a lab. Required. + :type lab_secret: ~azure.mgmt.devtestlabs.models.LabSecret + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabSecret or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + lab_secret: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LabSecret]: + """Create or replace an existing Lab Secret. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :param lab_secret: A shared secret in a lab. Required. + :type lab_secret: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabSecret or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + lab_secret: Union[_models.LabSecret, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.LabSecret]: + """Create or replace an existing Lab Secret. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :param lab_secret: A shared secret in a lab. Is either a LabSecret type or a IO type. Required. + :type lab_secret: ~azure.mgmt.devtestlabs.models.LabSecret or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabSecret or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + lab_secret=lab_secret, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabSecret", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete lab secret. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + async def _update_initial( + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> _models.LabSecret: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + + _secret = _models.SecretFragment(identity=identity, tags=tags) + _json = self._serialize.body(_secret, "SecretFragment") + + request = build_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LabSecret", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("LabSecret", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.LabSecret]: + """Allows modifying tags of lab secrets. All other properties will be ignored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :param tags: The tags of the resource. Default value is None. + :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabSecret or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + tags=tags, + identity=identity, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabSecret", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_labs_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_labs_operations.py index 17fc4776e464..93f4d56627a7 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_labs_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_labs_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,6 +37,7 @@ build_create_environment_request, build_create_or_update_request, build_delete_request, + build_ensure_current_user_profile_request, build_export_resource_usage_request, build_generate_upload_uri_request, build_get_request, @@ -47,10 +48,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,8 +85,8 @@ def list_by_subscription( :param expand: Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -105,10 +102,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("LabList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +172,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs"} @distributed_trace def list_by_resource_group( @@ -190,13 +186,14 @@ def list_by_resource_group( ) -> AsyncIterable["_models.Lab"]: """List labs in a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param expand: Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -212,10 +209,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -241,7 +236,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -257,7 +252,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -265,14 +260,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("LabList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,7 +280,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + } @distributed_trace_async async def get( @@ -292,7 +290,8 @@ async def get( ) -> _models.Lab: """Get lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -315,10 +314,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Lab] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Lab] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -331,10 +328,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,7 +348,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } async def _create_or_update_initial( self, resource_group_name: str, name: str, lab: Union[_models.Lab, IO], **kwargs: Any @@ -366,16 +366,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Lab] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Lab] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(lab, (IO, bytes)): + if isinstance(lab, (IOBase, bytes)): _content = lab else: _json = self._serialize.body(lab, "Lab") @@ -393,10 +391,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -412,11 +411,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("Lab", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } @overload async def begin_create_or_update( @@ -430,7 +431,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Lab]: """Create or replace an existing lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -458,7 +460,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Lab]: """Create or replace an existing lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -486,11 +489,12 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Lab]: """Create or replace an existing lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str - :param lab: A lab. Is either a model type or a IO type. Required. + :param lab: A lab. Is either a Lab type or a IO type. Required. :type lab: ~azure.mgmt.devtestlabs.models.Lab or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -510,16 +514,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Lab] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Lab] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, name=name, lab=lab, @@ -539,7 +541,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -551,9 +556,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -569,10 +576,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -584,10 +589,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -596,16 +602,26 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Delete lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -624,13 +640,11 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -648,7 +662,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -660,22 +677,32 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.Lab: """Allows modifying tags of labs. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Lab or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Lab @@ -692,13 +719,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Lab] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Lab] = kwargs.pop("cls", None) - _lab = _models.LabFragment(tags=tags) + _lab = _models.LabFragment(identity=identity, tags=tags) _json = self._serialize.body(_lab, "LabFragment") request = build_update_request( @@ -713,10 +738,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -732,7 +758,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } async def _claim_any_vm_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -748,10 +776,8 @@ async def _claim_any_vm_initial( # pylint: disable=inconsistent-return-statemen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_claim_any_vm_request( resource_group_name=resource_group_name, @@ -763,10 +789,11 @@ async def _claim_any_vm_initial( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -775,17 +802,27 @@ async def _claim_any_vm_initial( # pylint: disable=inconsistent-return-statemen map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _claim_any_vm_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm"} # type: ignore + _claim_any_vm_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm" + } @distributed_trace_async async def begin_claim_any_vm(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Claim a random claimable virtual machine in the lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -804,13 +841,11 @@ async def begin_claim_any_vm(self, resource_group_name: str, name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._claim_any_vm_initial( # type: ignore resource_group_name=resource_group_name, @@ -828,7 +863,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -840,9 +878,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_claim_any_vm.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm"} # type: ignore + begin_claim_any_vm.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm" + } async def _create_environment_initial( # pylint: disable=inconsistent-return-statements self, @@ -862,16 +902,14 @@ async def _create_environment_initial( # pylint: disable=inconsistent-return-st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(lab_virtual_machine_creation_parameter, (IO, bytes)): + if isinstance(lab_virtual_machine_creation_parameter, (IOBase, bytes)): _content = lab_virtual_machine_creation_parameter else: _json = self._serialize.body(lab_virtual_machine_creation_parameter, "LabVirtualMachineCreationParameter") @@ -889,10 +927,11 @@ async def _create_environment_initial( # pylint: disable=inconsistent-return-st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -901,10 +940,19 @@ async def _create_environment_initial( # pylint: disable=inconsistent-return-st map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _create_environment_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment"} # type: ignore + _create_environment_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment" + } @overload async def begin_create_environment( @@ -918,7 +966,8 @@ async def begin_create_environment( ) -> AsyncLROPoller[None]: """Create virtual machines in a lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -954,7 +1003,8 @@ async def begin_create_environment( ) -> AsyncLROPoller[None]: """Create virtual machines in a lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -987,12 +1037,13 @@ async def begin_create_environment( ) -> AsyncLROPoller[None]: """Create virtual machines in a lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str :param lab_virtual_machine_creation_parameter: Properties for creating a virtual machine. Is - either a model type or a IO type. Required. + either a LabVirtualMachineCreationParameter type or a IO type. Required. :type lab_virtual_machine_creation_parameter: ~azure.mgmt.devtestlabs.models.LabVirtualMachineCreationParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1013,14 +1064,12 @@ async def begin_create_environment( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_environment_initial( # type: ignore resource_group_name=resource_group_name, @@ -1040,7 +1089,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1052,9 +1104,71 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_environment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment" + } + + @distributed_trace_async + async def ensure_current_user_profile( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, name: str, **kwargs: Any + ) -> None: + """Ensure the current user has a valid profile in the lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the lab. Required. + :type 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ensure_current_user_profile_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.ensure_current_user_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response - begin_create_environment.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment"} # type: ignore + 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, {}) + + ensure_current_user_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/ensureCurrentUserProfile" + } async def _export_resource_usage_initial( # pylint: disable=inconsistent-return-statements self, @@ -1075,11 +1189,9 @@ async def _export_resource_usage_initial( # pylint: disable=inconsistent-return _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _export_resource_usage_parameters = _models.ExportResourceUsageParameters( blob_storage_absolute_sas_uri=blob_storage_absolute_sas_uri, usage_start_date=usage_start_date @@ -1098,10 +1210,11 @@ async def _export_resource_usage_initial( # pylint: disable=inconsistent-return params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1110,10 +1223,19 @@ async def _export_resource_usage_initial( # pylint: disable=inconsistent-return map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _export_resource_usage_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage"} # type: ignore + _export_resource_usage_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage" + } @distributed_trace_async async def begin_export_resource_usage( @@ -1127,7 +1249,8 @@ async def begin_export_resource_usage( """Exports the lab resource usage into a storage account This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1152,14 +1275,12 @@ async def begin_export_resource_usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._export_resource_usage_initial( # type: ignore resource_group_name=resource_group_name, @@ -1180,7 +1301,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1192,9 +1316,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_export_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage"} # type: ignore + begin_export_resource_usage.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage" + } @distributed_trace_async async def generate_upload_uri( @@ -1202,7 +1328,8 @@ async def generate_upload_uri( ) -> _models.GenerateUploadUriResponse: """Generate a URI for uploading custom disk images to a Lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1224,11 +1351,9 @@ async def generate_upload_uri( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateUploadUriResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.GenerateUploadUriResponse] = kwargs.pop("cls", None) _generate_upload_uri_parameter = _models.GenerateUploadUriParameter(blob_name=blob_name) _json = self._serialize.body(_generate_upload_uri_parameter, "GenerateUploadUriParameter") @@ -1245,10 +1370,11 @@ async def generate_upload_uri( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1264,7 +1390,9 @@ async def generate_upload_uri( return deserialized - generate_upload_uri.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri"} # type: ignore + generate_upload_uri.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri" + } async def _import_virtual_machine_initial( # pylint: disable=inconsistent-return-statements self, @@ -1285,11 +1413,9 @@ async def _import_virtual_machine_initial( # pylint: disable=inconsistent-retur _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _import_lab_virtual_machine_request = _models.ImportLabVirtualMachineRequest( destination_virtual_machine_name=destination_virtual_machine_name, @@ -1309,10 +1435,11 @@ async def _import_virtual_machine_initial( # pylint: disable=inconsistent-retur params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1321,10 +1448,19 @@ async def _import_virtual_machine_initial( # pylint: disable=inconsistent-retur map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _import_virtual_machine_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine"} # type: ignore + _import_virtual_machine_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine" + } @distributed_trace_async async def begin_import_virtual_machine( @@ -1337,7 +1473,8 @@ async def begin_import_virtual_machine( ) -> AsyncLROPoller[None]: """Import a virtual machine into a different lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1362,14 +1499,12 @@ async def begin_import_virtual_machine( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._import_virtual_machine_initial( # type: ignore resource_group_name=resource_group_name, @@ -1390,7 +1525,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1402,15 +1540,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_import_virtual_machine.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine"} # type: ignore + begin_import_virtual_machine.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine" + } @distributed_trace def list_vhds(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterable["_models.LabVhd"]: """List disk images available for custom image creation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1422,10 +1563,8 @@ def list_vhds(self, resource_group_name: str, name: str, **kwargs: Any) -> Async _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVhdList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabVhdList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1448,7 +1587,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1464,7 +1603,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1472,14 +1611,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("LabVhdList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1491,4 +1631,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_vhds.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds"} # type: ignore + list_vhds.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_notification_channels_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_notification_channels_operations.py index 1325861c2b07..4ef349a3d36f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_notification_channels_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_notification_channels_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -38,10 +38,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,15 +74,16 @@ def list( ) -> AsyncIterable["_models.NotificationChannel"]: """List notification channels in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=webHookUrl)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -103,10 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationChannelList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotificationChannelList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NotificationChannelList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +172,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels" + } @distributed_trace_async async def get( @@ -184,7 +182,8 @@ async def get( ) -> _models.NotificationChannel: """Get notification channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -209,10 +208,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationChannel] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotificationChannel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -226,10 +223,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,7 +243,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}" + } @overload async def create_or_update( @@ -258,9 +258,10 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.NotificationChannel: - """Create or replace an existing notification channel. + """Create or replace an existing Notification Channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -288,9 +289,10 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.NotificationChannel: - """Create or replace an existing notification channel. + """Create or replace an existing Notification Channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -316,15 +318,17 @@ async def create_or_update( notification_channel: Union[_models.NotificationChannel, IO], **kwargs: Any ) -> _models.NotificationChannel: - """Create or replace an existing notification channel. + """Create or replace an existing Notification Channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the notification channel. Required. :type name: str - :param notification_channel: A notification. Is either a model type or a IO type. Required. + :param notification_channel: A notification. Is either a NotificationChannel type or a IO type. + Required. :type notification_channel: ~azure.mgmt.devtestlabs.models.NotificationChannel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -345,16 +349,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationChannel] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotificationChannel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(notification_channel, (IO, bytes)): + if isinstance(notification_channel, (IOBase, bytes)): _content = notification_channel else: _json = self._serialize.body(notification_channel, "NotificationChannel") @@ -373,10 +375,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -392,11 +395,13 @@ async def create_or_update( deserialized = self._deserialize("NotificationChannel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -404,7 +409,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete notification channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -426,10 +432,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -442,10 +446,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,15 +462,24 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.NotificationChannel: """Allows modifying tags of notification channels. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -473,6 +487,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: NotificationChannel or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.NotificationChannel @@ -489,13 +505,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationChannel] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.NotificationChannel] = kwargs.pop("cls", None) - _notification_channel = _models.NotificationChannelFragment(tags=tags) + _notification_channel = _models.NotificationChannelFragment(identity=identity, tags=tags) _json = self._serialize.body(_notification_channel, "NotificationChannelFragment") request = build_update_request( @@ -511,10 +525,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -530,7 +545,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}" + } @distributed_trace_async async def notify( # pylint: disable=inconsistent-return-statements @@ -544,14 +561,14 @@ async def notify( # pylint: disable=inconsistent-return-statements ) -> None: """Send notification to provided channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the notification channel. Required. :type name: str - :param event_name: The type of event (i.e. AutoShutdown, Cost). Known values are: - "AutoShutdown" and "Cost". Default value is None. + :param event_name: The type of event (i.e. AutoShutdown). "AutoShutdown" Default value is None. :type event_name: str or ~azure.mgmt.devtestlabs.models.NotificationChannelEventType :param json_payload: Properties for the notification in json format. Default value is None. :type json_payload: str @@ -571,11 +588,9 @@ async def notify( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _notify_parameters = _models.NotifyParameters(event_name=event_name, json_payload=json_payload) _json = self._serialize.body(_notify_parameters, "NotifyParameters") @@ -593,10 +608,11 @@ async def notify( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,4 +624,6 @@ async def notify( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - notify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify"} # type: ignore + notify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_operations.py index d8ecc67e486e..847935123566 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,10 +74,8 @@ async def get(self, location_name: str, name: str, **kwargs: Any) -> _models.Ope _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationResult] = kwargs.pop("cls", None) request = build_get_request( location_name=location_name, @@ -94,10 +87,11 @@ async def get(self, location_name: str, name: str, **kwargs: Any) -> _models.Ope params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -106,15 +100,23 @@ async def get(self, location_name: str, name: str, **kwargs: Any) -> _models.Ope map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("OperationResult", pipeline_response) if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + deserialized = self._deserialize("OperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_policies_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_policies_operations.py index 008d0110669c..e1d021d327bf 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_policies_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_policies_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +37,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +74,8 @@ def list( ) -> AsyncIterable["_models.Policy"]: """List policies in a given policy set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -87,8 +84,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=description)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -104,10 +101,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,7 +130,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -151,7 +146,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -159,14 +154,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PolicyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,7 +174,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies" + } @distributed_trace_async async def get( @@ -192,7 +190,8 @@ async def get( ) -> _models.Policy: """Get policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -219,10 +218,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -237,10 +234,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,7 +254,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}" + } @overload async def create_or_update( @@ -272,7 +272,8 @@ async def create_or_update( ) -> _models.Policy: """Create or replace an existing policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -305,7 +306,8 @@ async def create_or_update( ) -> _models.Policy: """Create or replace an existing policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -336,7 +338,8 @@ async def create_or_update( ) -> _models.Policy: """Create or replace an existing policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -344,7 +347,7 @@ async def create_or_update( :type policy_set_name: str :param name: The name of the policy. Required. :type name: str - :param policy: A Policy. Is either a model type or a IO type. Required. + :param policy: A Policy. Is either a Policy type or a IO type. Required. :type policy: ~azure.mgmt.devtestlabs.models.Policy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -365,16 +368,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(policy, (IO, bytes)): + if isinstance(policy, (IOBase, bytes)): _content = policy else: _json = self._serialize.body(policy, "Policy") @@ -394,10 +395,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,11 +415,13 @@ async def create_or_update( deserialized = self._deserialize("Policy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -425,7 +429,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -449,10 +454,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -466,10 +469,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -481,7 +485,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}" + } @distributed_trace_async async def update( @@ -491,11 +497,13 @@ async def update( policy_set_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Policy: """Allows modifying tags of policies. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -505,6 +513,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Policy or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Policy @@ -521,13 +531,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) - _policy = _models.PolicyFragment(tags=tags) + _policy = _models.PolicyFragment(identity=identity, tags=tags) _json = self._serialize.body(_policy, "PolicyFragment") request = build_update_request( @@ -544,10 +552,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,4 +572,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_policy_sets_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_policy_sets_operations.py index dd1cb56d31a2..a776b4a32307 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_policy_sets_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_policy_sets_operations.py @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -20,18 +21,15 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._policy_sets_operations import build_evaluate_policies_request +from ...operations._policy_sets_operations import build_evaluate_policies_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,6 +53,115 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PolicySet"]: + """List policy sets in a given lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicySet or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devtestlabs.models.PolicySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicySetList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PolicySetList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets" + } + @distributed_trace_async async def evaluate_policies( self, @@ -66,7 +173,8 @@ async def evaluate_policies( ) -> _models.EvaluatePoliciesResponse: """Evaluates lab policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -90,11 +198,9 @@ async def evaluate_policies( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EvaluatePoliciesResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.EvaluatePoliciesResponse] = kwargs.pop("cls", None) _evaluate_policies_request = _models.EvaluatePoliciesRequest(policies=policies) _json = self._serialize.body(_evaluate_policies_request, "EvaluatePoliciesRequest") @@ -112,10 +218,11 @@ async def evaluate_policies( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,4 +238,6 @@ async def evaluate_policies( return deserialized - evaluate_policies.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies"} # type: ignore + evaluate_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_provider_operations_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_provider_operations_operations.py index e225f5f9dba6..961bcea5885b 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_provider_operations_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_provider_operations_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._provider_operations_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,10 +65,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationMetadata"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProviderOperationResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +86,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +102,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,14 +110,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProviderOperationResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,4 +130,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.DevTestLab/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DevTestLab/operations"} diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_schedules_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_schedules_operations.py index 64231191e917..1622ffab957f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_schedules_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_schedules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,15 +77,16 @@ def list( ) -> AsyncIterable["_models.Schedule"]: """List schedules in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -105,10 +102,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,7 +130,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -151,7 +146,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -159,14 +154,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,7 +174,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules" + } @distributed_trace_async async def get( @@ -186,7 +184,8 @@ async def get( ) -> _models.Schedule: """Get schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -211,10 +210,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -228,10 +225,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,7 +245,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}" + } @overload async def create_or_update( @@ -262,7 +262,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -292,7 +293,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -315,13 +317,14 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the schedule. Required. :type name: str - :param schedule: A schedule. Is either a model type or a IO type. Required. + :param schedule: A schedule. Is either a Schedule type or a IO type. Required. :type schedule: ~azure.mgmt.devtestlabs.models.Schedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -342,16 +345,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(schedule, (IO, bytes)): + if isinstance(schedule, (IOBase, bytes)): _content = schedule else: _json = self._serialize.body(schedule, "Schedule") @@ -370,10 +371,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,11 +391,13 @@ async def create_or_update( deserialized = self._deserialize("Schedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -401,7 +405,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -423,10 +428,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -439,10 +442,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,15 +458,24 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.Schedule: """Allows modifying tags of schedules. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -470,6 +483,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Schedule @@ -486,13 +501,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _schedule = _models.ScheduleFragment(tags=tags) + _schedule = _models.ScheduleFragment(identity=identity, tags=tags) _json = self._serialize.body(_schedule, "ScheduleFragment") request = build_update_request( @@ -508,10 +521,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,7 +541,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}" + } async def _execute_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -543,10 +559,8 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( resource_group_name=resource_group_name, @@ -559,10 +573,11 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -571,10 +586,19 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _execute_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute"} # type: ignore + _execute_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute" + } @distributed_trace_async async def begin_execute( @@ -582,7 +606,8 @@ async def begin_execute( ) -> AsyncLROPoller[None]: """Execute a schedule. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -603,13 +628,11 @@ async def begin_execute( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._execute_initial( # type: ignore resource_group_name=resource_group_name, @@ -628,7 +651,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -640,9 +666,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_execute.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute"} # type: ignore + begin_execute.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute" + } @distributed_trace def list_applicable( @@ -650,7 +678,8 @@ def list_applicable( ) -> AsyncIterable["_models.Schedule"]: """Lists all applicable schedules. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -664,10 +693,8 @@ def list_applicable( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -691,7 +718,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -707,7 +734,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -715,14 +742,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -734,4 +762,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_applicable.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable"} # type: ignore + list_applicable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_secrets_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_secrets_operations.py index b9530db36634..704d038882e5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_secrets_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_secrets_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +76,8 @@ def list( ) -> AsyncIterable["_models.Secret"]: """List secrets in a given user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -89,8 +86,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=value)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -106,10 +103,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SecretList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -137,7 +132,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -153,7 +148,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -161,14 +156,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecretList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,7 +176,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets" + } @distributed_trace_async async def get( @@ -194,7 +192,8 @@ async def get( ) -> _models.Secret: """Get secret. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -221,10 +220,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -239,10 +236,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -258,7 +256,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } async def _create_or_update_initial( self, @@ -280,16 +280,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(secret, (IO, bytes)): + if isinstance(secret, (IOBase, bytes)): _content = secret else: _json = self._serialize.body(secret, "Secret") @@ -309,10 +307,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -328,11 +327,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("Secret", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } @overload async def begin_create_or_update( @@ -348,7 +349,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Secret]: """Create or replace an existing secret. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -389,7 +391,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Secret]: """Create or replace an existing secret. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -428,7 +431,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.Secret]: """Create or replace an existing secret. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -436,7 +440,7 @@ async def begin_create_or_update( :type user_name: str :param name: The name of the secret. Required. :type name: str - :param secret: A secret. Is either a model type or a IO type. Required. + :param secret: A secret. Is either a Secret type or a IO type. Required. :type secret: ~azure.mgmt.devtestlabs.models.Secret or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -457,16 +461,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, user_name=user_name, @@ -488,7 +490,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -500,9 +505,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -510,7 +517,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete secret. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -534,10 +542,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -551,10 +557,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -566,7 +573,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } @distributed_trace_async async def update( @@ -576,11 +585,13 @@ async def update( user_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Secret: """Allows modifying tags of secrets. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -590,6 +601,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Secret or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Secret @@ -606,13 +619,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - _secret = _models.SecretFragment(tags=tags) + _secret = _models.SecretFragment(identity=identity, tags=tags) _json = self._serialize.body(_secret, "SecretFragment") request = build_update_request( @@ -629,10 +640,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -648,4 +660,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_fabric_schedules_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_fabric_schedules_operations.py index cee26ec28292..c29f230c0e95 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_fabric_schedules_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_fabric_schedules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +78,8 @@ def list( ) -> AsyncIterable["_models.Schedule"]: """List schedules in a given service fabric. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -93,8 +90,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -110,10 +107,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -142,7 +137,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -158,7 +153,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -166,14 +161,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -185,7 +181,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules" + } @distributed_trace_async async def get( @@ -200,7 +198,8 @@ async def get( ) -> _models.Schedule: """Get schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -229,10 +228,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -248,10 +245,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,7 +265,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}" + } @overload async def create_or_update( @@ -284,7 +284,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -320,7 +321,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -354,7 +356,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -364,7 +367,7 @@ async def create_or_update( :type service_fabric_name: str :param name: The name of the schedule. Required. :type name: str - :param schedule: A schedule. Is either a model type or a IO type. Required. + :param schedule: A schedule. Is either a Schedule type or a IO type. Required. :type schedule: ~azure.mgmt.devtestlabs.models.Schedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -385,16 +388,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(schedule, (IO, bytes)): + if isinstance(schedule, (IOBase, bytes)): _content = schedule else: _json = self._serialize.body(schedule, "Schedule") @@ -415,10 +416,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -434,11 +436,13 @@ async def create_or_update( deserialized = self._deserialize("Schedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -452,7 +456,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -478,10 +483,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -496,10 +499,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -511,7 +515,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}" + } @distributed_trace_async async def update( @@ -522,11 +528,13 @@ async def update( service_fabric_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Schedule: """Allows modifying tags of schedules. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -538,6 +546,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Schedule @@ -554,13 +564,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _schedule = _models.ScheduleFragment(tags=tags) + _schedule = _models.ScheduleFragment(identity=identity, tags=tags) _json = self._serialize.body(_schedule, "ScheduleFragment") request = build_update_request( @@ -578,10 +586,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,7 +606,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}" + } async def _execute_initial( # pylint: disable=inconsistent-return-statements self, @@ -619,10 +630,8 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( resource_group_name=resource_group_name, @@ -637,10 +646,11 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,10 +659,19 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _execute_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute"} # type: ignore + _execute_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute" + } @distributed_trace_async async def begin_execute( @@ -666,7 +685,8 @@ async def begin_execute( ) -> AsyncLROPoller[None]: """Execute a schedule. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -691,13 +711,11 @@ async def begin_execute( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._execute_initial( # type: ignore resource_group_name=resource_group_name, @@ -718,7 +736,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -730,6 +751,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_execute.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute"} # type: ignore + begin_execute.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_fabrics_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_fabrics_operations.py index 9e255d1de472..712e3f3ca4d8 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_fabrics_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_fabrics_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -42,10 +42,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +79,8 @@ def list( ) -> AsyncIterable["_models.ServiceFabric"]: """List service fabrics in a given user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -92,8 +89,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -109,10 +106,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabricList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceFabricList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -140,7 +135,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -156,7 +151,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -164,14 +159,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ServiceFabricList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,7 +179,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics" + } @distributed_trace_async async def get( @@ -197,7 +195,8 @@ async def get( ) -> _models.ServiceFabric: """Get service fabric. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -224,10 +223,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabric] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceFabric] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -242,10 +239,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -261,7 +259,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } async def _create_or_update_initial( self, @@ -283,16 +283,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabric] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceFabric] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(service_fabric, (IO, bytes)): + if isinstance(service_fabric, (IOBase, bytes)): _content = service_fabric else: _json = self._serialize.body(service_fabric, "ServiceFabric") @@ -312,10 +310,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,11 +330,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("ServiceFabric", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } @overload async def begin_create_or_update( @@ -349,9 +350,10 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ServiceFabric]: - """Create or replace an existing service fabric. This operation can take a while to complete. + """Create or replace an existing Service Fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -390,9 +392,10 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ServiceFabric]: - """Create or replace an existing service fabric. This operation can take a while to complete. + """Create or replace an existing Service Fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -429,9 +432,10 @@ async def begin_create_or_update( service_fabric: Union[_models.ServiceFabric, IO], **kwargs: Any ) -> AsyncLROPoller[_models.ServiceFabric]: - """Create or replace an existing service fabric. This operation can take a while to complete. + """Create or replace an existing Service Fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -439,7 +443,7 @@ async def begin_create_or_update( :type user_name: str :param name: The name of the service fabric. Required. :type name: str - :param service_fabric: A Service Fabric. Is either a model type or a IO type. Required. + :param service_fabric: A Service Fabric. Is either a ServiceFabric type or a IO type. Required. :type service_fabric: ~azure.mgmt.devtestlabs.models.ServiceFabric or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -460,16 +464,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabric] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceFabric] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, user_name=user_name, @@ -491,7 +493,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -503,9 +508,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -521,10 +528,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -538,10 +543,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -550,10 +556,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } @distributed_trace_async async def begin_delete( @@ -561,7 +576,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete service fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -584,13 +600,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -610,7 +624,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -622,9 +639,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } @distributed_trace_async async def update( @@ -634,11 +653,13 @@ async def update( user_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.ServiceFabric: """Allows modifying tags of service fabrics. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -648,6 +669,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceFabric or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.ServiceFabric @@ -664,13 +687,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabric] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.ServiceFabric] = kwargs.pop("cls", None) - _service_fabric = _models.ServiceFabricFragment(tags=tags) + _service_fabric = _models.ServiceFabricFragment(identity=identity, tags=tags) _json = self._serialize.body(_service_fabric, "ServiceFabricFragment") request = build_update_request( @@ -687,10 +708,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -706,7 +728,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } @distributed_trace_async async def list_applicable_schedules( @@ -714,7 +738,8 @@ async def list_applicable_schedules( ) -> _models.ApplicableSchedule: """Lists the applicable start/stop schedules, if any. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -738,10 +763,8 @@ async def list_applicable_schedules( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicableSchedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicableSchedule] = kwargs.pop("cls", None) request = build_list_applicable_schedules_request( resource_group_name=resource_group_name, @@ -755,10 +778,11 @@ async def list_applicable_schedules( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -774,7 +798,9 @@ async def list_applicable_schedules( return deserialized - list_applicable_schedules.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules"} # type: ignore + list_applicable_schedules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules" + } async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -790,10 +816,8 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -807,10 +831,11 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -819,10 +844,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start" + } @distributed_trace_async async def begin_start( @@ -830,7 +864,8 @@ async def begin_start( ) -> AsyncLROPoller[None]: """Start a service fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -853,13 +888,11 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -879,7 +912,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -891,9 +927,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start" + } async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -909,10 +947,8 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -926,10 +962,11 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -938,10 +975,19 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop"} # type: ignore + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop" + } @distributed_trace_async async def begin_stop( @@ -949,7 +995,8 @@ async def begin_stop( ) -> AsyncLROPoller[None]: """Stop a service fabric This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -972,13 +1019,11 @@ async def begin_stop( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -998,7 +1043,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1010,6 +1058,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_runners_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_runners_operations.py index 22e0bff083ae..b66542c6f51c 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_runners_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_service_runners_operations.py @@ -6,9 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,10 +21,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -30,12 +35,9 @@ build_create_or_update_request, build_delete_request, build_get_request, + build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,11 +61,121 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceRunner"]: + """List service runners in a given lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceRunner or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devtestlabs.models.ServiceRunner] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRunnerList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceRunnerList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners" + } + @distributed_trace_async async def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> _models.ServiceRunner: """Get service runner. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -85,10 +197,8 @@ async def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceRunner] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRunner] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -101,10 +211,11 @@ async def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,7 +231,9 @@ async def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}" + } @overload async def create_or_update( @@ -133,9 +246,10 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.ServiceRunner: - """Create or replace an existing service runner. + """Create or replace an existing Service runner. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -164,9 +278,10 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.ServiceRunner: - """Create or replace an existing service runner. + """Create or replace an existing Service runner. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -193,16 +308,17 @@ async def create_or_update( service_runner: Union[_models.ServiceRunner, IO], **kwargs: Any ) -> _models.ServiceRunner: - """Create or replace an existing service runner. + """Create or replace an existing Service runner. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the service runner. Required. :type name: str :param service_runner: A container for a managed identity to execute DevTest lab services. Is - either a model type or a IO type. Required. + either a ServiceRunner type or a IO type. Required. :type service_runner: ~azure.mgmt.devtestlabs.models.ServiceRunner or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -223,16 +339,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceRunner] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceRunner] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(service_runner, (IO, bytes)): + if isinstance(service_runner, (IOBase, bytes)): _content = service_runner else: _json = self._serialize.body(service_runner, "ServiceRunner") @@ -251,10 +365,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,29 +385,17 @@ async def create_or_update( deserialized = self._deserialize("ServiceRunner", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}" + } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any ) -> None: - """Delete service runner. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the service runner. Required. - :type 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: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -304,10 +407,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -315,24 +416,106 @@ async def delete( # pylint: disable=inconsistent-return-statements name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete service runner. This operation can take a while to complete. - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"} # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the service runner. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_shared_galleries_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_shared_galleries_operations.py new file mode 100644 index 000000000000..c011d92f7839 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_shared_galleries_operations.py @@ -0,0 +1,548 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._shared_galleries_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SharedGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devtestlabs.aio.DevTestLabsClient`'s + :attr:`shared_galleries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SharedGallery"]: + """List shared galleries in a given lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param expand: Specify the $expand query. Example: 'properties($select=identity)'. Default + value is None. + :type expand: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedGallery or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devtestlabs.models.SharedGallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedGalleryList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SharedGalleryList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, lab_name: str, name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.SharedGallery: + """Get shared gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param expand: Specify the $expand query. Example: 'properties($select=identity)'. Default + value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedGallery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + shared_gallery: _models.SharedGallery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedGallery: + """Create or replace an existing Shared Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param shared_gallery: Properties of a shared gallery. Required. + :type shared_gallery: ~azure.mgmt.devtestlabs.models.SharedGallery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + shared_gallery: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedGallery: + """Create or replace an existing Shared Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param shared_gallery: Properties of a shared gallery. Required. + :type shared_gallery: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + shared_gallery: Union[_models.SharedGallery, IO], + **kwargs: Any + ) -> _models.SharedGallery: + """Create or replace an existing Shared Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param shared_gallery: Properties of a shared gallery. Is either a SharedGallery type or a IO + type. Required. + :type shared_gallery: ~azure.mgmt.devtestlabs.models.SharedGallery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shared_gallery, (IOBase, bytes)): + _content = shared_gallery + else: + _json = self._serialize.body(shared_gallery, "SharedGallery") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SharedGallery", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SharedGallery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any + ) -> None: + """Delete shared gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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.DevTestLab/labs/{labName}/sharedgalleries/{name}" + } + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> _models.SharedGallery: + """Allows modifying tags of shared galleries. All other properties will be ignored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param tags: The tags of the resource. Default value is None. + :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + _shared_gallery = _models.SharedGalleryFragment(identity=identity, tags=tags) + _json = self._serialize.body(_shared_gallery, "SharedGalleryFragment") + + request = build_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedGallery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_shared_images_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_shared_images_operations.py new file mode 100644 index 000000000000..7bbe5b6134d9 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_shared_images_operations.py @@ -0,0 +1,578 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._shared_images_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SharedImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devtestlabs.aio.DevTestLabsClient`'s + :attr:`shared_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SharedImage"]: + """List shared images in a given shared gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param expand: Specify the $expand query. Example: 'properties($expand=versions)'. Default + value is None. + :type expand: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedImage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.devtestlabs.models.SharedImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedImageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SharedImageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.SharedImage: + """Get shared image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param expand: Specify the $expand query. Example: 'properties($expand=versions)'. Default + value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedImage] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + name=name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedImage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + shared_image: _models.SharedImage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedImage: + """Create or replace an existing Shared Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param shared_image: Properties of a shared image. Required. + :type shared_image: ~azure.mgmt.devtestlabs.models.SharedImage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + shared_image: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedImage: + """Create or replace an existing Shared Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param shared_image: Properties of a shared image. Required. + :type shared_image: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + shared_image: Union[_models.SharedImage, IO], + **kwargs: Any + ) -> _models.SharedImage: + """Create or replace an existing Shared Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param shared_image: Properties of a shared image. Is either a SharedImage type or a IO type. + Required. + :type shared_image: ~azure.mgmt.devtestlabs.models.SharedImage or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedImage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shared_image, (IOBase, bytes)): + _content = shared_image + else: + _json = self._serialize.body(shared_image, "SharedImage") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SharedImage", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SharedImage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, shared_gallery_name: str, name: str, **kwargs: Any + ) -> None: + """Delete shared image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}" + } + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> _models.SharedImage: + """Allows modifying tags of shared images. All other properties will be ignored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param tags: The tags of the resource. Default value is None. + :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.SharedImage] = kwargs.pop("cls", None) + + _shared_image = _models.SharedImageFragment(identity=identity, tags=tags) + _json = self._serialize.body(_shared_image, "SharedImageFragment") + + request = build_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedImage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_users_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_users_operations.py index 23aef28b03a7..a2a19200765f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_users_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_users_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,15 +75,16 @@ def list( ) -> AsyncIterable["_models.User"]: """List user profiles in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=identity)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -103,10 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +172,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users" + } @distributed_trace_async async def get( @@ -184,7 +182,8 @@ async def get( ) -> _models.User: """Get user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -209,10 +208,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.User] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -226,10 +223,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,10 +243,17 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } async def _create_or_update_initial( - self, resource_group_name: str, lab_name: str, name: str, user: Union[_models.User, IO], **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + user: Optional[Union[_models.User, IO]] = None, + **kwargs: Any ) -> _models.User: error_map = { 401: ClientAuthenticationError, @@ -261,19 +266,20 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.User] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.User] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: - _json = self._serialize.body(user, "User") + if user is not None: + _json = self._serialize.body(user, "User") + else: + _json = None request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -289,10 +295,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -308,11 +315,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("User", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } @overload async def begin_create_or_update( @@ -320,20 +329,21 @@ async def begin_create_or_update( resource_group_name: str, lab_name: str, name: str, - user: _models.User, + user: Optional[_models.User] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.User]: """Create or replace an existing user profile. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the user profile. Required. :type name: str - :param user: Profile of a lab user. Required. + :param user: Profile of a lab user. Default value is None. :type user: ~azure.mgmt.devtestlabs.models.User :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -357,20 +367,21 @@ async def begin_create_or_update( resource_group_name: str, lab_name: str, name: str, - user: IO, + user: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.User]: """Create or replace an existing user profile. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the user profile. Required. :type name: str - :param user: Profile of a lab user. Required. + :param user: Profile of a lab user. Default value is None. :type user: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -390,17 +401,23 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, lab_name: str, name: str, user: Union[_models.User, IO], **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + user: Optional[Union[_models.User, IO]] = None, + **kwargs: Any ) -> AsyncLROPoller[_models.User]: """Create or replace an existing user profile. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the user profile. Required. :type name: str - :param user: Profile of a lab user. Is either a model type or a IO type. Required. + :param user: Profile of a lab user. Is either a User type or a IO type. Default value is None. :type user: ~azure.mgmt.devtestlabs.models.User or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -420,16 +437,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.User] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.User] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -450,7 +465,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -462,9 +480,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -480,10 +500,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -496,10 +514,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -508,10 +527,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } @distributed_trace_async async def begin_delete( @@ -519,7 +547,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete user profile. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -540,13 +569,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -565,7 +592,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -577,17 +607,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.User: """Allows modifying tags of user profiles. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -595,6 +634,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: User or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.User @@ -611,13 +652,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.User] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.User] = kwargs.pop("cls", None) - _user = _models.UserFragment(tags=tags) + _user = _models.UserFragment(identity=identity, tags=tags) _json = self._serialize.body(_user, "UserFragment") request = build_update_request( @@ -633,10 +672,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -652,4 +692,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_machine_schedules_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_machine_schedules_operations.py index bd7dfe095fd7..f54195665da0 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_machine_schedules_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_machine_schedules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +77,8 @@ def list( ) -> AsyncIterable["_models.Schedule"]: """List schedules in a given virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -90,8 +87,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -107,10 +104,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -138,7 +133,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -154,7 +149,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -162,14 +157,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +177,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules" + } @distributed_trace_async async def get( @@ -195,7 +193,8 @@ async def get( ) -> _models.Schedule: """Get schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -222,10 +221,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -240,10 +237,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -259,7 +257,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}" + } @overload async def create_or_update( @@ -275,7 +275,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -308,7 +309,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -339,7 +341,8 @@ async def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -347,7 +350,7 @@ async def create_or_update( :type virtual_machine_name: str :param name: The name of the schedule. Required. :type name: str - :param schedule: A schedule. Is either a model type or a IO type. Required. + :param schedule: A schedule. Is either a Schedule type or a IO type. Required. :type schedule: ~azure.mgmt.devtestlabs.models.Schedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -368,16 +371,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(schedule, (IO, bytes)): + if isinstance(schedule, (IOBase, bytes)): _content = schedule else: _json = self._serialize.body(schedule, "Schedule") @@ -397,10 +398,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -416,11 +418,13 @@ async def create_or_update( deserialized = self._deserialize("Schedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -428,7 +432,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -452,10 +457,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -469,10 +472,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,7 +488,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}" + } @distributed_trace_async async def update( @@ -494,11 +500,13 @@ async def update( virtual_machine_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Schedule: """Allows modifying tags of schedules. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -508,6 +516,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Schedule @@ -524,13 +534,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _schedule = _models.ScheduleFragment(tags=tags) + _schedule = _models.ScheduleFragment(identity=identity, tags=tags) _json = self._serialize.body(_schedule, "ScheduleFragment") request = build_update_request( @@ -547,10 +555,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -566,7 +575,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}" + } async def _execute_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, virtual_machine_name: str, name: str, **kwargs: Any @@ -582,10 +593,8 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( resource_group_name=resource_group_name, @@ -599,10 +608,11 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,10 +621,19 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _execute_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute"} # type: ignore + _execute_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute" + } @distributed_trace_async async def begin_execute( @@ -622,7 +641,8 @@ async def begin_execute( ) -> AsyncLROPoller[None]: """Execute a schedule. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -645,13 +665,11 @@ async def begin_execute( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._execute_initial( # type: ignore resource_group_name=resource_group_name, @@ -671,7 +689,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -683,6 +704,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_execute.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute"} # type: ignore + begin_execute.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_machines_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_machines_operations.py index a297bce04390..6fde22c2f1d5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_machines_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_machines_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -35,6 +35,7 @@ build_add_data_disk_request, build_apply_artifacts_request, build_claim_request, + build_clear_artifact_results_request, build_create_or_update_request, build_delete_request, build_detach_data_disk_request, @@ -52,10 +53,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +89,8 @@ def list( ) -> AsyncIterable["_models.LabVirtualMachine"]: """List virtual machines in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -100,8 +98,8 @@ def list( 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -118,10 +116,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachineList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabVirtualMachineList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -148,7 +144,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -164,7 +160,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -172,14 +168,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("LabVirtualMachineList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +188,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines" + } @distributed_trace_async async def get( @@ -199,7 +198,8 @@ async def get( ) -> _models.LabVirtualMachine: """Get virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -225,10 +225,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachine] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabVirtualMachine] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -242,10 +240,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -261,7 +260,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } async def _create_or_update_initial( self, @@ -282,16 +283,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachine] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabVirtualMachine] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(lab_virtual_machine, (IO, bytes)): + if isinstance(lab_virtual_machine, (IOBase, bytes)): _content = lab_virtual_machine else: _json = self._serialize.body(lab_virtual_machine, "LabVirtualMachine") @@ -310,10 +309,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -329,11 +329,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("LabVirtualMachine", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } @overload async def begin_create_or_update( @@ -346,9 +348,10 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LabVirtualMachine]: - """Create or replace an existing virtual machine. This operation can take a while to complete. + """Create or replace an existing Virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -384,9 +387,10 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LabVirtualMachine]: - """Create or replace an existing virtual machine. This operation can take a while to complete. + """Create or replace an existing Virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -420,15 +424,17 @@ async def begin_create_or_update( lab_virtual_machine: Union[_models.LabVirtualMachine, IO], **kwargs: Any ) -> AsyncLROPoller[_models.LabVirtualMachine]: - """Create or replace an existing virtual machine. This operation can take a while to complete. + """Create or replace an existing Virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the virtual machine. Required. :type name: str - :param lab_virtual_machine: A virtual machine. Is either a model type or a IO type. Required. + :param lab_virtual_machine: A virtual machine. Is either a LabVirtualMachine type or a IO type. + Required. :type lab_virtual_machine: ~azure.mgmt.devtestlabs.models.LabVirtualMachine or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -449,16 +455,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachine] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabVirtualMachine] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -479,7 +483,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -491,9 +498,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -509,10 +518,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -525,10 +532,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,10 +545,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } @distributed_trace_async async def begin_delete( @@ -548,7 +565,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -569,13 +587,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -594,7 +610,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -606,17 +625,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.LabVirtualMachine: """Allows modifying tags of virtual machines. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -624,6 +652,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: LabVirtualMachine or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.LabVirtualMachine @@ -640,13 +670,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachine] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.LabVirtualMachine] = kwargs.pop("cls", None) - _lab_virtual_machine = _models.LabVirtualMachineFragment(tags=tags) + _lab_virtual_machine = _models.LabVirtualMachineFragment(identity=identity, tags=tags) _json = self._serialize.body(_lab_virtual_machine, "LabVirtualMachineFragment") request = build_update_request( @@ -662,10 +690,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,7 +710,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } async def _add_data_disk_initial( # pylint: disable=inconsistent-return-statements self, @@ -702,16 +733,14 @@ async def _add_data_disk_initial( # pylint: disable=inconsistent-return-stateme _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_disk_properties, (IO, bytes)): + if isinstance(data_disk_properties, (IOBase, bytes)): _content = data_disk_properties else: _json = self._serialize.body(data_disk_properties, "DataDiskProperties") @@ -730,10 +759,11 @@ async def _add_data_disk_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,10 +772,19 @@ async def _add_data_disk_initial( # pylint: disable=inconsistent-return-stateme map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _add_data_disk_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk"} # type: ignore + _add_data_disk_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk" + } @overload async def begin_add_data_disk( @@ -761,7 +800,8 @@ async def begin_add_data_disk( """Attach a new or existing data disk to virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -800,7 +840,8 @@ async def begin_add_data_disk( """Attach a new or existing data disk to virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -837,14 +878,15 @@ async def begin_add_data_disk( """Attach a new or existing data disk to virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the virtual machine. Required. :type name: str :param data_disk_properties: Request body for adding a new or existing data disk to a virtual - machine. Is either a model type or a IO type. Required. + machine. Is either a DataDiskProperties type or a IO type. Required. :type data_disk_properties: ~azure.mgmt.devtestlabs.models.DataDiskProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -864,14 +906,12 @@ async def begin_add_data_disk( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._add_data_disk_initial( # type: ignore resource_group_name=resource_group_name, @@ -892,7 +932,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -904,9 +947,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_add_data_disk.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk"} # type: ignore + begin_add_data_disk.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk" + } async def _apply_artifacts_initial( # pylint: disable=inconsistent-return-statements self, @@ -927,11 +972,9 @@ async def _apply_artifacts_initial( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _apply_artifacts_request = _models.ApplyArtifactsRequest(artifacts=artifacts) _json = self._serialize.body(_apply_artifacts_request, "ApplyArtifactsRequest") @@ -949,10 +992,11 @@ async def _apply_artifacts_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -961,10 +1005,19 @@ async def _apply_artifacts_initial( # pylint: disable=inconsistent-return-state map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _apply_artifacts_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts"} # type: ignore + _apply_artifacts_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts" + } @distributed_trace_async async def begin_apply_artifacts( @@ -977,7 +1030,8 @@ async def begin_apply_artifacts( ) -> AsyncLROPoller[None]: """Apply artifacts to virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1000,14 +1054,12 @@ async def begin_apply_artifacts( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._apply_artifacts_initial( # type: ignore resource_group_name=resource_group_name, @@ -1028,7 +1080,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1040,9 +1095,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_apply_artifacts.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts"} # type: ignore + begin_apply_artifacts.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts" + } async def _claim_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -1058,10 +1115,8 @@ async def _claim_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_claim_request( resource_group_name=resource_group_name, @@ -1074,10 +1129,11 @@ async def _claim_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1086,10 +1142,19 @@ async def _claim_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _claim_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim"} # type: ignore + _claim_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim" + } @distributed_trace_async async def begin_claim( @@ -1097,7 +1162,8 @@ async def begin_claim( ) -> AsyncLROPoller[None]: """Take ownership of an existing virtual machine This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1118,13 +1184,11 @@ async def begin_claim( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._claim_initial( # type: ignore resource_group_name=resource_group_name, @@ -1143,7 +1207,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1155,9 +1222,74 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_claim.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim" + } - begin_claim.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim"} # type: ignore + @distributed_trace_async + async def clear_artifact_results( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any + ) -> None: + """Clears the artifact results of the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the virtual machine. Required. + :type 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_clear_artifact_results_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.clear_artifact_results.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + clear_artifact_results.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/clearArtifactResults" + } async def _detach_data_disk_initial( # pylint: disable=inconsistent-return-statements self, @@ -1178,11 +1310,9 @@ async def _detach_data_disk_initial( # pylint: disable=inconsistent-return-stat _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _detach_data_disk_properties = _models.DetachDataDiskProperties(existing_lab_disk_id=existing_lab_disk_id) _json = self._serialize.body(_detach_data_disk_properties, "DetachDataDiskProperties") @@ -1200,10 +1330,11 @@ async def _detach_data_disk_initial( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1212,10 +1343,19 @@ async def _detach_data_disk_initial( # pylint: disable=inconsistent-return-stat map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _detach_data_disk_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk"} # type: ignore + _detach_data_disk_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk" + } @distributed_trace_async async def begin_detach_data_disk( @@ -1229,7 +1369,8 @@ async def begin_detach_data_disk( """Detach the specified disk from the virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1253,14 +1394,12 @@ async def begin_detach_data_disk( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._detach_data_disk_initial( # type: ignore resource_group_name=resource_group_name, @@ -1281,7 +1420,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1293,9 +1435,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_detach_data_disk.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk"} # type: ignore + begin_detach_data_disk.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk" + } @distributed_trace_async async def get_rdp_file_contents( @@ -1303,7 +1447,8 @@ async def get_rdp_file_contents( ) -> _models.RdpConnection: """Gets a string that represents the contents of the RDP file for the virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1325,10 +1470,8 @@ async def get_rdp_file_contents( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RdpConnection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RdpConnection] = kwargs.pop("cls", None) request = build_get_rdp_file_contents_request( resource_group_name=resource_group_name, @@ -1341,10 +1484,11 @@ async def get_rdp_file_contents( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1360,7 +1504,9 @@ async def get_rdp_file_contents( return deserialized - get_rdp_file_contents.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents"} # type: ignore + get_rdp_file_contents.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents" + } @distributed_trace_async async def list_applicable_schedules( @@ -1368,7 +1514,8 @@ async def list_applicable_schedules( ) -> _models.ApplicableSchedule: """Lists the applicable start/stop schedules, if any. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1390,10 +1537,8 @@ async def list_applicable_schedules( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicableSchedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicableSchedule] = kwargs.pop("cls", None) request = build_list_applicable_schedules_request( resource_group_name=resource_group_name, @@ -1406,10 +1551,11 @@ async def list_applicable_schedules( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1425,7 +1571,9 @@ async def list_applicable_schedules( return deserialized - list_applicable_schedules.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules"} # type: ignore + list_applicable_schedules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules" + } async def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -1441,10 +1589,8 @@ async def _redeploy_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_redeploy_request( resource_group_name=resource_group_name, @@ -1457,10 +1603,11 @@ async def _redeploy_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1469,10 +1616,19 @@ async def _redeploy_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _redeploy_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy"} # type: ignore + _redeploy_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy" + } @distributed_trace_async async def begin_redeploy( @@ -1480,7 +1636,8 @@ async def begin_redeploy( ) -> AsyncLROPoller[None]: """Redeploy a virtual machine This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1501,13 +1658,11 @@ async def begin_redeploy( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._redeploy_initial( # type: ignore resource_group_name=resource_group_name, @@ -1526,7 +1681,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1538,9 +1696,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_redeploy.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy"} # type: ignore + begin_redeploy.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy" + } async def _resize_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, size: Optional[str] = None, **kwargs: Any @@ -1556,11 +1716,9 @@ async def _resize_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _resize_lab_virtual_machine_properties = _models.ResizeLabVirtualMachineProperties(size=size) _json = self._serialize.body(_resize_lab_virtual_machine_properties, "ResizeLabVirtualMachineProperties") @@ -1578,10 +1736,11 @@ async def _resize_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1590,10 +1749,19 @@ async def _resize_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _resize_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize"} # type: ignore + _resize_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize" + } @distributed_trace_async async def begin_resize( @@ -1601,7 +1769,8 @@ async def begin_resize( ) -> AsyncLROPoller[None]: """Resize Virtual Machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1624,14 +1793,12 @@ async def begin_resize( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._resize_initial( # type: ignore resource_group_name=resource_group_name, @@ -1652,7 +1819,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1664,9 +1834,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_resize.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize"} # type: ignore + begin_resize.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize" + } async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -1682,10 +1854,8 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( resource_group_name=resource_group_name, @@ -1698,10 +1868,11 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1710,10 +1881,19 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _restart_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart"} # type: ignore + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart" + } @distributed_trace_async async def begin_restart( @@ -1721,7 +1901,8 @@ async def begin_restart( ) -> AsyncLROPoller[None]: """Restart a virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1742,13 +1923,11 @@ async def begin_restart( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._restart_initial( # type: ignore resource_group_name=resource_group_name, @@ -1767,7 +1946,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1779,9 +1961,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart"} # type: ignore + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart" + } async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -1797,10 +1981,8 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1813,10 +1995,11 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1825,10 +2008,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start" + } @distributed_trace_async async def begin_start( @@ -1836,7 +2028,8 @@ async def begin_start( ) -> AsyncLROPoller[None]: """Start a virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1857,13 +2050,11 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1882,7 +2073,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1894,9 +2088,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start" + } async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -1912,10 +2108,8 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -1928,10 +2122,11 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1940,10 +2135,19 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop"} # type: ignore + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop" + } @distributed_trace_async async def begin_stop( @@ -1951,7 +2155,8 @@ async def begin_stop( ) -> AsyncLROPoller[None]: """Stop a virtual machine This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1972,13 +2177,11 @@ async def begin_stop( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -1997,7 +2200,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2009,9 +2215,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop" + } async def _transfer_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -2027,10 +2235,8 @@ async def _transfer_disks_initial( # pylint: disable=inconsistent-return-statem _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_transfer_disks_request( resource_group_name=resource_group_name, @@ -2043,10 +2249,11 @@ async def _transfer_disks_initial( # pylint: disable=inconsistent-return-statem params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2055,10 +2262,19 @@ async def _transfer_disks_initial( # pylint: disable=inconsistent-return-statem map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _transfer_disks_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks"} # type: ignore + _transfer_disks_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks" + } @distributed_trace_async async def begin_transfer_disks( @@ -2067,7 +2283,8 @@ async def begin_transfer_disks( """Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2088,13 +2305,11 @@ async def begin_transfer_disks( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._transfer_disks_initial( # type: ignore resource_group_name=resource_group_name, @@ -2113,7 +2328,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2125,9 +2343,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_transfer_disks.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks"} # type: ignore + begin_transfer_disks.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks" + } async def _un_claim_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -2143,10 +2363,8 @@ async def _un_claim_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_un_claim_request( resource_group_name=resource_group_name, @@ -2159,10 +2377,11 @@ async def _un_claim_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2171,10 +2390,19 @@ async def _un_claim_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _un_claim_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim"} # type: ignore + _un_claim_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim" + } @distributed_trace_async async def begin_un_claim( @@ -2182,7 +2410,8 @@ async def begin_un_claim( ) -> AsyncLROPoller[None]: """Release ownership of an existing virtual machine This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2203,13 +2432,11 @@ async def begin_un_claim( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._un_claim_initial( # type: ignore resource_group_name=resource_group_name, @@ -2228,7 +2455,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2240,6 +2470,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_un_claim.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim"} # type: ignore + begin_un_claim.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_networks_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_networks_operations.py index d72c561ffead..3c636f68340c 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_networks_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,15 +75,16 @@ def list( ) -> AsyncIterable["_models.VirtualNetwork"]: """List virtual networks in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($expand=externalSubnets)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -103,10 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetworkList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -133,7 +128,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -149,7 +144,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -157,14 +152,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,7 +172,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks" + } @distributed_trace_async async def get( @@ -184,7 +182,8 @@ async def get( ) -> _models.VirtualNetwork: """Get virtual network. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -209,10 +208,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetwork] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -226,10 +223,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,7 +243,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } async def _create_or_update_initial( self, @@ -266,16 +266,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetwork] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtual_network, (IO, bytes)): + if isinstance(virtual_network, (IOBase, bytes)): _content = virtual_network else: _json = self._serialize.body(virtual_network, "VirtualNetwork") @@ -294,10 +292,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,11 +312,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } @overload async def begin_create_or_update( @@ -332,7 +333,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.VirtualNetwork]: """Create or replace an existing virtual network. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -370,7 +372,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.VirtualNetwork]: """Create or replace an existing virtual network. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -406,13 +409,15 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.VirtualNetwork]: """Create or replace an existing virtual network. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the virtual network. Required. :type name: str - :param virtual_network: A virtual network. Is either a model type or a IO type. Required. + :param virtual_network: A virtual network. Is either a VirtualNetwork type or a IO type. + Required. :type virtual_network: ~azure.mgmt.devtestlabs.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -433,16 +438,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetwork] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -463,7 +466,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -475,9 +481,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -493,10 +501,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -509,10 +515,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -521,10 +528,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } @distributed_trace_async async def begin_delete( @@ -532,7 +548,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete virtual network. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -553,13 +570,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -578,7 +593,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -590,17 +608,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } @distributed_trace_async async def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.VirtualNetwork: """Allows modifying tags of virtual networks. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -608,6 +635,8 @@ async def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetwork or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.VirtualNetwork @@ -624,13 +653,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetwork] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) - _virtual_network = _models.VirtualNetworkFragment(tags=tags) + _virtual_network = _models.VirtualNetworkFragment(identity=identity, tags=tags) _json = self._serialize.body(_virtual_network, "VirtualNetworkFragment") request = build_update_request( @@ -646,10 +673,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,4 +693,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/__init__.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/__init__.py index 1056d2951f76..09066c7647ee 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/__init__.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/__init__.py @@ -7,14 +7,12 @@ # -------------------------------------------------------------------------- from ._models_py3 import ApplicableSchedule -from ._models_py3 import ApplicableScheduleFragment from ._models_py3 import ApplyArtifactsRequest from ._models_py3 import ArmTemplate from ._models_py3 import ArmTemplateInfo from ._models_py3 import ArmTemplateList from ._models_py3 import ArmTemplateParameterProperties from ._models_py3 import Artifact -from ._models_py3 import ArtifactDeploymentStatusProperties from ._models_py3 import ArtifactInstallProperties from ._models_py3 import ArtifactList from ._models_py3 import ArtifactParameterProperties @@ -22,22 +20,18 @@ from ._models_py3 import ArtifactSourceFragment from ._models_py3 import ArtifactSourceList from ._models_py3 import AttachDiskProperties -from ._models_py3 import AttachNewDataDiskOptions -from ._models_py3 import BulkCreationParameters +from ._models_py3 import BastionHost +from ._models_py3 import BastionHostFragment +from ._models_py3 import BastionHostList from ._models_py3 import CloudErrorBody from ._models_py3 import ComputeDataDisk from ._models_py3 import ComputeVmInstanceViewStatus -from ._models_py3 import ComputeVmProperties -from ._models_py3 import CostThresholdProperties from ._models_py3 import CustomImage from ._models_py3 import CustomImageFragment from ._models_py3 import CustomImageList -from ._models_py3 import CustomImagePropertiesCustom -from ._models_py3 import CustomImagePropertiesFromPlan -from ._models_py3 import CustomImagePropertiesFromVm +from ._models_py3 import CustomImagePropertiesFromPlanFragment from ._models_py3 import DataDiskProperties from ._models_py3 import DataDiskStorageTypeInfo -from ._models_py3 import DayDetails from ._models_py3 import DetachDataDiskProperties from ._models_py3 import DetachDiskProperties from ._models_py3 import Disk @@ -46,7 +40,6 @@ from ._models_py3 import DtlEnvironment from ._models_py3 import DtlEnvironmentFragment from ._models_py3 import DtlEnvironmentList -from ._models_py3 import EnvironmentDeploymentProperties from ._models_py3 import EvaluatePoliciesProperties from ._models_py3 import EvaluatePoliciesRequest from ._models_py3 import EvaluatePoliciesResponse @@ -56,49 +49,41 @@ from ._models_py3 import Formula from ._models_py3 import FormulaFragment from ._models_py3 import FormulaList -from ._models_py3 import FormulaPropertiesFromVm from ._models_py3 import GalleryImage from ._models_py3 import GalleryImageList -from ._models_py3 import GalleryImageReference from ._models_py3 import GenerateArmTemplateRequest from ._models_py3 import GenerateUploadUriParameter from ._models_py3 import GenerateUploadUriResponse -from ._models_py3 import HourDetails from ._models_py3 import IdentityProperties +from ._models_py3 import ImageVersionProperties from ._models_py3 import ImportLabVirtualMachineRequest from ._models_py3 import InboundNatRule from ._models_py3 import Lab -from ._models_py3 import LabAnnouncementProperties -from ._models_py3 import LabCost -from ._models_py3 import LabCostDetailsProperties -from ._models_py3 import LabCostSummaryProperties from ._models_py3 import LabFragment from ._models_py3 import LabList -from ._models_py3 import LabResourceCostProperties -from ._models_py3 import LabSupportProperties +from ._models_py3 import LabSecret +from ._models_py3 import LabSecretFragment +from ._models_py3 import LabSecretList from ._models_py3 import LabVhd from ._models_py3 import LabVhdList from ._models_py3 import LabVirtualMachine from ._models_py3 import LabVirtualMachineCreationParameter from ._models_py3 import LabVirtualMachineFragment from ._models_py3 import LabVirtualMachineList -from ._models_py3 import LinuxOsInfo -from ._models_py3 import NetworkInterfaceProperties from ._models_py3 import NotificationChannel from ._models_py3 import NotificationChannelFragment from ._models_py3 import NotificationChannelList -from ._models_py3 import NotificationSettings from ._models_py3 import NotifyParameters -from ._models_py3 import OperationError from ._models_py3 import OperationMetadata from ._models_py3 import OperationMetadataDisplay from ._models_py3 import OperationResult from ._models_py3 import ParameterInfo from ._models_py3 import ParametersValueFileInfo -from ._models_py3 import PercentageCostThresholdProperties from ._models_py3 import Policy from ._models_py3 import PolicyFragment from ._models_py3 import PolicyList +from ._models_py3 import PolicySet +from ._models_py3 import PolicySetList from ._models_py3 import PolicySetResult from ._models_py3 import PolicyViolation from ._models_py3 import Port @@ -114,66 +99,69 @@ from ._models_py3 import Secret from ._models_py3 import SecretFragment from ._models_py3 import SecretList +from ._models_py3 import SecurityProfile from ._models_py3 import ServiceFabric from ._models_py3 import ServiceFabricFragment from ._models_py3 import ServiceFabricList from ._models_py3 import ServiceRunner from ._models_py3 import ServiceRunnerList -from ._models_py3 import SharedPublicIpAddressConfiguration -from ._models_py3 import ShutdownNotificationContent +from ._models_py3 import SharedGallery +from ._models_py3 import SharedGalleryFragment +from ._models_py3 import SharedGalleryList +from ._models_py3 import SharedImage +from ._models_py3 import SharedImageFragment +from ._models_py3 import SharedImageList from ._models_py3 import Subnet from ._models_py3 import SubnetOverride -from ._models_py3 import SubnetSharedPublicIpAddressConfiguration -from ._models_py3 import TargetCostProperties +from ._models_py3 import SystemData +from ._models_py3 import UefiSettings from ._models_py3 import UpdateResource from ._models_py3 import User from ._models_py3 import UserFragment -from ._models_py3 import UserIdentity from ._models_py3 import UserList -from ._models_py3 import UserSecretStore from ._models_py3 import VirtualNetwork from ._models_py3 import VirtualNetworkFragment from ._models_py3 import VirtualNetworkList -from ._models_py3 import WeekDetails -from ._models_py3 import WindowsOsInfo +from ._models_py3 import WeekDetailsFragment -from ._dev_test_labs_client_enums import CostThresholdStatus -from ._dev_test_labs_client_enums import CostType +from ._dev_test_labs_client_enums import CreatedByType from ._dev_test_labs_client_enums import CustomImageOsType +from ._dev_test_labs_client_enums import EnableState from ._dev_test_labs_client_enums import EnableStatus +from ._dev_test_labs_client_enums import EncryptionType from ._dev_test_labs_client_enums import EnvironmentPermission from ._dev_test_labs_client_enums import FileUploadOptions from ._dev_test_labs_client_enums import HostCachingOptions from ._dev_test_labs_client_enums import HttpStatusCode +from ._dev_test_labs_client_enums import ImageType from ._dev_test_labs_client_enums import LinuxOsState from ._dev_test_labs_client_enums import ManagedIdentityType from ._dev_test_labs_client_enums import NotificationChannelEventType +from ._dev_test_labs_client_enums import OsType from ._dev_test_labs_client_enums import PolicyEvaluatorType from ._dev_test_labs_client_enums import PolicyFactName from ._dev_test_labs_client_enums import PolicyStatus from ._dev_test_labs_client_enums import PremiumDataDisk -from ._dev_test_labs_client_enums import ReportingCycleType +from ._dev_test_labs_client_enums import SecurityTypes from ._dev_test_labs_client_enums import SourceControlType from ._dev_test_labs_client_enums import StorageType -from ._dev_test_labs_client_enums import TargetCostStatus +from ._dev_test_labs_client_enums import StorageTypes from ._dev_test_labs_client_enums import TransportProtocol from ._dev_test_labs_client_enums import UsagePermissionType from ._dev_test_labs_client_enums import VirtualMachineCreationSource from ._dev_test_labs_client_enums import WindowsOsState from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ "ApplicableSchedule", - "ApplicableScheduleFragment", "ApplyArtifactsRequest", "ArmTemplate", "ArmTemplateInfo", "ArmTemplateList", "ArmTemplateParameterProperties", "Artifact", - "ArtifactDeploymentStatusProperties", "ArtifactInstallProperties", "ArtifactList", "ArtifactParameterProperties", @@ -181,22 +169,18 @@ "ArtifactSourceFragment", "ArtifactSourceList", "AttachDiskProperties", - "AttachNewDataDiskOptions", - "BulkCreationParameters", + "BastionHost", + "BastionHostFragment", + "BastionHostList", "CloudErrorBody", "ComputeDataDisk", "ComputeVmInstanceViewStatus", - "ComputeVmProperties", - "CostThresholdProperties", "CustomImage", "CustomImageFragment", "CustomImageList", - "CustomImagePropertiesCustom", - "CustomImagePropertiesFromPlan", - "CustomImagePropertiesFromVm", + "CustomImagePropertiesFromPlanFragment", "DataDiskProperties", "DataDiskStorageTypeInfo", - "DayDetails", "DetachDataDiskProperties", "DetachDiskProperties", "Disk", @@ -205,7 +189,6 @@ "DtlEnvironment", "DtlEnvironmentFragment", "DtlEnvironmentList", - "EnvironmentDeploymentProperties", "EvaluatePoliciesProperties", "EvaluatePoliciesRequest", "EvaluatePoliciesResponse", @@ -215,49 +198,41 @@ "Formula", "FormulaFragment", "FormulaList", - "FormulaPropertiesFromVm", "GalleryImage", "GalleryImageList", - "GalleryImageReference", "GenerateArmTemplateRequest", "GenerateUploadUriParameter", "GenerateUploadUriResponse", - "HourDetails", "IdentityProperties", + "ImageVersionProperties", "ImportLabVirtualMachineRequest", "InboundNatRule", "Lab", - "LabAnnouncementProperties", - "LabCost", - "LabCostDetailsProperties", - "LabCostSummaryProperties", "LabFragment", "LabList", - "LabResourceCostProperties", - "LabSupportProperties", + "LabSecret", + "LabSecretFragment", + "LabSecretList", "LabVhd", "LabVhdList", "LabVirtualMachine", "LabVirtualMachineCreationParameter", "LabVirtualMachineFragment", "LabVirtualMachineList", - "LinuxOsInfo", - "NetworkInterfaceProperties", "NotificationChannel", "NotificationChannelFragment", "NotificationChannelList", - "NotificationSettings", "NotifyParameters", - "OperationError", "OperationMetadata", "OperationMetadataDisplay", "OperationResult", "ParameterInfo", "ParametersValueFileInfo", - "PercentageCostThresholdProperties", "Policy", "PolicyFragment", "PolicyList", + "PolicySet", + "PolicySetList", "PolicySetResult", "PolicyViolation", "Port", @@ -273,47 +248,52 @@ "Secret", "SecretFragment", "SecretList", + "SecurityProfile", "ServiceFabric", "ServiceFabricFragment", "ServiceFabricList", "ServiceRunner", "ServiceRunnerList", - "SharedPublicIpAddressConfiguration", - "ShutdownNotificationContent", + "SharedGallery", + "SharedGalleryFragment", + "SharedGalleryList", + "SharedImage", + "SharedImageFragment", + "SharedImageList", "Subnet", "SubnetOverride", - "SubnetSharedPublicIpAddressConfiguration", - "TargetCostProperties", + "SystemData", + "UefiSettings", "UpdateResource", "User", "UserFragment", - "UserIdentity", "UserList", - "UserSecretStore", "VirtualNetwork", "VirtualNetworkFragment", "VirtualNetworkList", - "WeekDetails", - "WindowsOsInfo", - "CostThresholdStatus", - "CostType", + "WeekDetailsFragment", + "CreatedByType", "CustomImageOsType", + "EnableState", "EnableStatus", + "EncryptionType", "EnvironmentPermission", "FileUploadOptions", "HostCachingOptions", "HttpStatusCode", + "ImageType", "LinuxOsState", "ManagedIdentityType", "NotificationChannelEventType", + "OsType", "PolicyEvaluatorType", "PolicyFactName", "PolicyStatus", "PremiumDataDisk", - "ReportingCycleType", + "SecurityTypes", "SourceControlType", "StorageType", - "TargetCostStatus", + "StorageTypes", "TransportProtocol", "UsagePermissionType", "VirtualMachineCreationSource", diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/_dev_test_labs_client_enums.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/_dev_test_labs_client_enums.py index 1b1972d20bfb..ca726f80ed3e 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/_dev_test_labs_client_enums.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/_dev_test_labs_client_enums.py @@ -10,19 +10,13 @@ from azure.core import CaseInsensitiveEnumMeta -class CostThresholdStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether this threshold will be displayed on cost charts.""" +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class CostType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the cost.""" - - UNAVAILABLE = "Unavailable" - REPORTED = "Reported" - PROJECTED = "Projected" + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" class CustomImageOsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -33,6 +27,15 @@ class CustomImageOsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" +class EnableState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enables all images in the gallery to be available in the lab for VM creation. This will + override the EnableState on shared images. + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + + class EnableStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates if the artifact source is enabled (values: Enabled, Disabled).""" @@ -40,6 +43,15 @@ class EnableStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" +class EncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the type of key used to encrypt the data of the disk. Possible values include: + 'EncryptionAtRestWithPlatformKey', 'EncryptionAtRestWithCustomerKey'. + """ + + ENCRYPTION_AT_REST_WITH_PLATFORM_KEY = "EncryptionAtRestWithPlatformKey" + ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY = "EncryptionAtRestWithCustomerKey" + + class EnvironmentPermission(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The access rights to be granted to the user when provisioning an environment.""" @@ -69,6 +81,8 @@ class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONTINUE = "Continue" SWITCHING_PROTOCOLS = "SwitchingProtocols" + PROCESSING = "Processing" + EARLY_HINTS = "EarlyHints" OK = "OK" CREATED = "Created" ACCEPTED = "Accepted" @@ -76,6 +90,9 @@ class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): NO_CONTENT = "NoContent" RESET_CONTENT = "ResetContent" PARTIAL_CONTENT = "PartialContent" + MULTI_STATUS = "MultiStatus" + ALREADY_REPORTED = "AlreadyReported" + IM_USED = "IMUsed" MULTIPLE_CHOICES = "MultipleChoices" AMBIGUOUS = "Ambiguous" MOVED_PERMANENTLY = "MovedPermanently" @@ -89,6 +106,7 @@ class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNUSED = "Unused" TEMPORARY_REDIRECT = "TemporaryRedirect" REDIRECT_KEEP_VERB = "RedirectKeepVerb" + PERMANENT_REDIRECT = "PermanentRedirect" BAD_REQUEST = "BadRequest" UNAUTHORIZED = "Unauthorized" PAYMENT_REQUIRED = "PaymentRequired" @@ -107,13 +125,34 @@ class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNSUPPORTED_MEDIA_TYPE = "UnsupportedMediaType" REQUESTED_RANGE_NOT_SATISFIABLE = "RequestedRangeNotSatisfiable" EXPECTATION_FAILED = "ExpectationFailed" + MISDIRECTED_REQUEST = "MisdirectedRequest" + UNPROCESSABLE_ENTITY = "UnprocessableEntity" + LOCKED = "Locked" + FAILED_DEPENDENCY = "FailedDependency" UPGRADE_REQUIRED = "UpgradeRequired" + PRECONDITION_REQUIRED = "PreconditionRequired" + TOO_MANY_REQUESTS = "TooManyRequests" + REQUEST_HEADER_FIELDS_TOO_LARGE = "RequestHeaderFieldsTooLarge" + UNAVAILABLE_FOR_LEGAL_REASONS = "UnavailableForLegalReasons" INTERNAL_SERVER_ERROR = "InternalServerError" NOT_IMPLEMENTED = "NotImplemented" BAD_GATEWAY = "BadGateway" SERVICE_UNAVAILABLE = "ServiceUnavailable" GATEWAY_TIMEOUT = "GatewayTimeout" HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported" + VARIANT_ALSO_NEGOTIATES = "VariantAlsoNegotiates" + INSUFFICIENT_STORAGE = "InsufficientStorage" + LOOP_DETECTED = "LoopDetected" + NOT_EXTENDED = "NotExtended" + NETWORK_AUTHENTICATION_REQUIRED = "NetworkAuthenticationRequired" + CONTINUE_ENUM = "Continue" + + +class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of image in the gallery (generalized or specialized).""" + + GENERALIZED = "Generalized" + SPECIALIZED = "Specialized" class LinuxOsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -125,7 +164,7 @@ class LinuxOsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Managed identity.""" + """Type of identity (SystemAssigned, UserAssigned, None).""" NONE = "None" SYSTEM_ASSIGNED = "SystemAssigned" @@ -134,10 +173,16 @@ class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class NotificationChannelEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The event type for which this notification is enabled (i.e. AutoShutdown, Cost).""" + """The event type for which this notification is enabled (i.e. AutoShutdown).""" AUTO_SHUTDOWN = "AutoShutdown" - COST = "Cost" + + +class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operating system of the image.""" + + WINDOWS = "Windows" + LINUX = "Linux" class PolicyEvaluatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -157,7 +202,6 @@ class PolicyFactName(str, Enum, metaclass=CaseInsensitiveEnumMeta): LAB_VM_SIZE = "LabVmSize" GALLERY_IMAGE = "GalleryImage" USER_OWNED_LAB_VM_COUNT_IN_SUBNET = "UserOwnedLabVmCountInSubnet" - LAB_TARGET_COST = "LabTargetCost" ENVIRONMENT_TEMPLATE = "EnvironmentTemplate" SCHEDULE_EDIT_PERMISSION = "ScheduleEditPermission" @@ -179,11 +223,14 @@ class PremiumDataDisk(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENABLED = "Enabled" -class ReportingCycleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Reporting cycle type.""" +class SecurityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the SecurityType of the virtual machine. It has to be set to any specified value to + enable UefiSettings. :code:`
`:code:`
` Default: UefiSettings will not be enabled unless + this property is set. + """ - CALENDAR_MONTH = "CalendarMonth" - CUSTOM = "Custom" + TRUSTED_LAUNCH = "TrustedLaunch" + CONFIDENTIAL_VM = "ConfidentialVM" class SourceControlType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -202,11 +249,12 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_SSD = "StandardSSD" -class TargetCostStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Target cost status.""" +class StorageTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Storage type to use for virtual machine (i.e. Standard, Premium, StandardSSD).""" - ENABLED = "Enabled" - DISABLED = "Disabled" + STANDARD = "Standard" + PREMIUM = "Premium" + STANDARD_SSD = "StandardSSD" class TransportProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/_models_py3.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/_models_py3.py index 57f5a64b7e6f..f7db8fb50bbc 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/_models_py3.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/_models_py3.py @@ -25,153 +25,683 @@ class Resource(_serialization.Model): - """An Azure resource. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype 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"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ super().__init__(**kwargs) self.id = None self.name = None self.type = None - self.location = location self.tags = tags + self.location = location -class ApplicableSchedule(Resource): - """Schedules applicable to a virtual machine. The schedules may have been defined on a VM or on lab level. +class ApplicableSchedule(Resource): # pylint: disable=too-many-instance-attributes + """Schedules applicable to a virtual machine. The schedules may have been defined on a VM or on + lab level. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar lab_vms_shutdown: The auto-shutdown schedule, if one has been set at the lab or lab - resource level. - :vartype lab_vms_shutdown: ~azure.mgmt.devtestlabs.models.Schedule - :ivar lab_vms_startup: The auto-startup schedule, if one has been set at the lab or lab - resource level. - :vartype lab_vms_startup: ~azure.mgmt.devtestlabs.models.Schedule + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar id_properties_lab_vms_startup_id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_lab_vms_startup_id: str + :ivar name_properties_lab_vms_startup_name: The name of the resource. + :vartype name_properties_lab_vms_startup_name: str + :ivar type_properties_lab_vms_startup_type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_lab_vms_startup_type: str + :ivar tags_properties_lab_vms_startup_tags: Resource tags. + :vartype tags_properties_lab_vms_startup_tags: dict[str, str] + :ivar location_properties_lab_vms_startup_location: The geo-location where the resource lives. + :vartype location_properties_lab_vms_startup_location: str + :ivar system_data_properties_lab_vms_startup_system_data: The system metadata relating to this + resource. + :vartype system_data_properties_lab_vms_startup_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_lab_vms_startup_properties_status: The status of the schedule (i.e. + Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_lab_vms_startup_properties_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar task_type_properties_lab_vms_startup_properties_task_type: The task type of the schedule + (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype task_type_properties_lab_vms_startup_properties_task_type: str + :ivar time_zone_id_properties_lab_vms_startup_properties_time_zone_id: The time zone ID (e.g. + Pacific Standard time). + :vartype time_zone_id_properties_lab_vms_startup_properties_time_zone_id: str + :ivar created_date_properties_lab_vms_startup_properties_created_date: The creation date of the + schedule. + :vartype created_date_properties_lab_vms_startup_properties_created_date: ~datetime.datetime + :ivar target_resource_id_properties_lab_vms_startup_properties_target_resource_id: The resource + ID to which the schedule belongs. + :vartype target_resource_id_properties_lab_vms_startup_properties_target_resource_id: str + :ivar provisioning_state_properties_lab_vms_startup_properties_provisioning_state: The + provisioning status of the resource. + :vartype provisioning_state_properties_lab_vms_startup_properties_provisioning_state: str + :ivar unique_identifier_properties_lab_vms_startup_properties_unique_identifier: The unique + immutable identifier of a resource (Guid). + :vartype unique_identifier_properties_lab_vms_startup_properties_unique_identifier: str + :ivar status_properties_lab_vms_startup_properties_notification_settings_status: If + notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype status_properties_lab_vms_startup_properties_notification_settings_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :ivar webhook_url_properties_lab_vms_startup_properties_notification_settings_webhook_url: The + webhook URL to which the notification will be sent. + :vartype webhook_url_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :ivar minute_properties_lab_vms_startup_properties_hourly_recurrence_minute: Minutes of the + hour the schedule will run. + :vartype minute_properties_lab_vms_startup_properties_hourly_recurrence_minute: int + :ivar time_properties_lab_vms_startup_properties_daily_recurrence_time: The time of day the + schedule will occur. + :vartype time_properties_lab_vms_startup_properties_daily_recurrence_time: str + :ivar weekdays_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: The days of + the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype weekdays_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: list[str] + :ivar time_properties_lab_vms_startup_properties_weekly_recurrence_time: The time of the day + the schedule will occur. + :vartype time_properties_lab_vms_startup_properties_weekly_recurrence_time: str + :ivar id_properties_lab_vms_shutdown_id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_lab_vms_shutdown_id: str + :ivar name_properties_lab_vms_shutdown_name: The name of the resource. + :vartype name_properties_lab_vms_shutdown_name: str + :ivar type_properties_lab_vms_shutdown_type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_lab_vms_shutdown_type: str + :ivar tags_properties_lab_vms_shutdown_tags: Resource tags. + :vartype tags_properties_lab_vms_shutdown_tags: dict[str, str] + :ivar location_properties_lab_vms_shutdown_location: The geo-location where the resource lives. + :vartype location_properties_lab_vms_shutdown_location: str + :ivar system_data_properties_lab_vms_shutdown_system_data: The system metadata relating to this + resource. + :vartype system_data_properties_lab_vms_shutdown_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_lab_vms_shutdown_properties_status: The status of the schedule (i.e. + Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_lab_vms_shutdown_properties_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar task_type_properties_lab_vms_shutdown_properties_task_type: The task type of the schedule + (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype task_type_properties_lab_vms_shutdown_properties_task_type: str + :ivar time_zone_id_properties_lab_vms_shutdown_properties_time_zone_id: The time zone ID (e.g. + Pacific Standard time). + :vartype time_zone_id_properties_lab_vms_shutdown_properties_time_zone_id: str + :ivar created_date_properties_lab_vms_shutdown_properties_created_date: The creation date of + the schedule. + :vartype created_date_properties_lab_vms_shutdown_properties_created_date: ~datetime.datetime + :ivar target_resource_id_properties_lab_vms_shutdown_properties_target_resource_id: The + resource ID to which the schedule belongs. + :vartype target_resource_id_properties_lab_vms_shutdown_properties_target_resource_id: str + :ivar provisioning_state_properties_lab_vms_shutdown_properties_provisioning_state: The + provisioning status of the resource. + :vartype provisioning_state_properties_lab_vms_shutdown_properties_provisioning_state: str + :ivar unique_identifier_properties_lab_vms_shutdown_properties_unique_identifier: The unique + immutable identifier of a resource (Guid). + :vartype unique_identifier_properties_lab_vms_shutdown_properties_unique_identifier: str + :ivar status_properties_lab_vms_shutdown_properties_notification_settings_status: If + notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype status_properties_lab_vms_shutdown_properties_notification_settings_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :ivar webhook_url_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: The + webhook URL to which the notification will be sent. + :vartype webhook_url_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :ivar minute_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: Minutes of the + hour the schedule will run. + :vartype minute_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: int + :ivar time_properties_lab_vms_shutdown_properties_daily_recurrence_time: The time of day the + schedule will occur. + :vartype time_properties_lab_vms_shutdown_properties_daily_recurrence_time: str + :ivar weekdays_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: The days of + the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype weekdays_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: list[str] + :ivar time_properties_lab_vms_shutdown_properties_weekly_recurrence_time: The time of the day + the schedule will occur. + :vartype time_properties_lab_vms_shutdown_properties_weekly_recurrence_time: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "id_properties_lab_vms_startup_id": {"readonly": True}, + "name_properties_lab_vms_startup_name": {"readonly": True}, + "type_properties_lab_vms_startup_type": {"readonly": True}, + "system_data_properties_lab_vms_startup_system_data": {"readonly": True}, + "created_date_properties_lab_vms_startup_properties_created_date": {"readonly": True}, + "provisioning_state_properties_lab_vms_startup_properties_provisioning_state": {"readonly": True}, + "unique_identifier_properties_lab_vms_startup_properties_unique_identifier": {"readonly": True}, + "id_properties_lab_vms_shutdown_id": {"readonly": True}, + "name_properties_lab_vms_shutdown_name": {"readonly": True}, + "type_properties_lab_vms_shutdown_type": {"readonly": True}, + "system_data_properties_lab_vms_shutdown_system_data": {"readonly": True}, + "created_date_properties_lab_vms_shutdown_properties_created_date": {"readonly": True}, + "provisioning_state_properties_lab_vms_shutdown_properties_provisioning_state": {"readonly": True}, + "unique_identifier_properties_lab_vms_shutdown_properties_unique_identifier": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "lab_vms_shutdown": {"key": "properties.labVmsShutdown", "type": "Schedule"}, - "lab_vms_startup": {"key": "properties.labVmsStartup", "type": "Schedule"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "id_properties_lab_vms_startup_id": {"key": "properties.labVmsStartup.id", "type": "str"}, + "name_properties_lab_vms_startup_name": {"key": "properties.labVmsStartup.name", "type": "str"}, + "type_properties_lab_vms_startup_type": {"key": "properties.labVmsStartup.type", "type": "str"}, + "tags_properties_lab_vms_startup_tags": {"key": "properties.labVmsStartup.tags", "type": "{str}"}, + "location_properties_lab_vms_startup_location": {"key": "properties.labVmsStartup.location", "type": "str"}, + "system_data_properties_lab_vms_startup_system_data": { + "key": "properties.labVmsStartup.systemData", + "type": "SystemData", + }, + "status_properties_lab_vms_startup_properties_status": { + "key": "properties.labVmsStartup.properties.status", + "type": "str", + }, + "task_type_properties_lab_vms_startup_properties_task_type": { + "key": "properties.labVmsStartup.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_lab_vms_startup_properties_time_zone_id": { + "key": "properties.labVmsStartup.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_lab_vms_startup_properties_created_date": { + "key": "properties.labVmsStartup.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_lab_vms_startup_properties_target_resource_id": { + "key": "properties.labVmsStartup.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_lab_vms_startup_properties_provisioning_state": { + "key": "properties.labVmsStartup.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_lab_vms_startup_properties_unique_identifier": { + "key": "properties.labVmsStartup.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_lab_vms_startup_properties_notification_settings_status": { + "key": "properties.labVmsStartup.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_lab_vms_startup_properties_notification_settings_time_in_minutes": { + "key": "properties.labVmsStartup.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_lab_vms_startup_properties_notification_settings_webhook_url": { + "key": "properties.labVmsStartup.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_lab_vms_startup_properties_notification_settings_email_recipient": { + "key": "properties.labVmsStartup.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_lab_vms_startup_properties_notification_settings_notification_locale": { + "key": "properties.labVmsStartup.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_lab_vms_startup_properties_hourly_recurrence_minute": { + "key": "properties.labVmsStartup.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_lab_vms_startup_properties_daily_recurrence_time": { + "key": "properties.labVmsStartup.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_lab_vms_startup_properties_weekly_recurrence_weekdays": { + "key": "properties.labVmsStartup.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_lab_vms_startup_properties_weekly_recurrence_time": { + "key": "properties.labVmsStartup.properties.weeklyRecurrence.time", + "type": "str", + }, + "id_properties_lab_vms_shutdown_id": {"key": "properties.labVmsShutdown.id", "type": "str"}, + "name_properties_lab_vms_shutdown_name": {"key": "properties.labVmsShutdown.name", "type": "str"}, + "type_properties_lab_vms_shutdown_type": {"key": "properties.labVmsShutdown.type", "type": "str"}, + "tags_properties_lab_vms_shutdown_tags": {"key": "properties.labVmsShutdown.tags", "type": "{str}"}, + "location_properties_lab_vms_shutdown_location": {"key": "properties.labVmsShutdown.location", "type": "str"}, + "system_data_properties_lab_vms_shutdown_system_data": { + "key": "properties.labVmsShutdown.systemData", + "type": "SystemData", + }, + "status_properties_lab_vms_shutdown_properties_status": { + "key": "properties.labVmsShutdown.properties.status", + "type": "str", + }, + "task_type_properties_lab_vms_shutdown_properties_task_type": { + "key": "properties.labVmsShutdown.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_lab_vms_shutdown_properties_time_zone_id": { + "key": "properties.labVmsShutdown.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_lab_vms_shutdown_properties_created_date": { + "key": "properties.labVmsShutdown.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_lab_vms_shutdown_properties_target_resource_id": { + "key": "properties.labVmsShutdown.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_lab_vms_shutdown_properties_provisioning_state": { + "key": "properties.labVmsShutdown.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_lab_vms_shutdown_properties_unique_identifier": { + "key": "properties.labVmsShutdown.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_lab_vms_shutdown_properties_notification_settings_status": { + "key": "properties.labVmsShutdown.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes": { + "key": "properties.labVmsShutdown.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_lab_vms_shutdown_properties_notification_settings_webhook_url": { + "key": "properties.labVmsShutdown.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_lab_vms_shutdown_properties_notification_settings_email_recipient": { + "key": "properties.labVmsShutdown.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_lab_vms_shutdown_properties_notification_settings_notification_locale": { + "key": "properties.labVmsShutdown.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_lab_vms_shutdown_properties_hourly_recurrence_minute": { + "key": "properties.labVmsShutdown.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_lab_vms_shutdown_properties_daily_recurrence_time": { + "key": "properties.labVmsShutdown.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays": { + "key": "properties.labVmsShutdown.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_lab_vms_shutdown_properties_weekly_recurrence_time": { + "key": "properties.labVmsShutdown.properties.weeklyRecurrence.time", + "type": "str", + }, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - lab_vms_shutdown: Optional["_models.Schedule"] = None, - lab_vms_startup: Optional["_models.Schedule"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - :keyword lab_vms_shutdown: The auto-shutdown schedule, if one has been set at the lab or lab - resource level. - :paramtype lab_vms_shutdown: ~azure.mgmt.devtestlabs.models.Schedule - :keyword lab_vms_startup: The auto-startup schedule, if one has been set at the lab or lab - resource level. - :paramtype lab_vms_startup: ~azure.mgmt.devtestlabs.models.Schedule - """ - super().__init__(location=location, tags=tags, **kwargs) - self.lab_vms_shutdown = lab_vms_shutdown - self.lab_vms_startup = lab_vms_startup - - -class UpdateResource(_serialization.Model): - """Represents an update resource. - - :ivar tags: The tags of the resource. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class ApplicableScheduleFragment(UpdateResource): - """Schedules applicable to a virtual machine. The schedules may have been defined on a VM or on lab level. - - :ivar tags: The tags of the resource. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: The tags of the resource. + tags_properties_lab_vms_startup_tags: Optional[Dict[str, str]] = None, + location_properties_lab_vms_startup_location: Optional[str] = None, + status_properties_lab_vms_startup_properties_status: Optional[Union[str, "_models.EnableStatus"]] = None, + task_type_properties_lab_vms_startup_properties_task_type: Optional[str] = None, + time_zone_id_properties_lab_vms_startup_properties_time_zone_id: Optional[str] = None, + target_resource_id_properties_lab_vms_startup_properties_target_resource_id: Optional[str] = None, + status_properties_lab_vms_startup_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_lab_vms_startup_properties_notification_settings_webhook_url: Optional[str] = None, + email_recipient_properties_lab_vms_startup_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_lab_vms_startup_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_lab_vms_startup_properties_hourly_recurrence_minute: Optional[int] = None, + time_properties_lab_vms_startup_properties_daily_recurrence_time: Optional[str] = None, + weekdays_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: Optional[List[str]] = None, + time_properties_lab_vms_startup_properties_weekly_recurrence_time: Optional[str] = None, + tags_properties_lab_vms_shutdown_tags: Optional[Dict[str, str]] = None, + location_properties_lab_vms_shutdown_location: Optional[str] = None, + status_properties_lab_vms_shutdown_properties_status: Optional[Union[str, "_models.EnableStatus"]] = None, + task_type_properties_lab_vms_shutdown_properties_task_type: Optional[str] = None, + time_zone_id_properties_lab_vms_shutdown_properties_time_zone_id: Optional[str] = None, + target_resource_id_properties_lab_vms_shutdown_properties_target_resource_id: Optional[str] = None, + status_properties_lab_vms_shutdown_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: Optional[str] = None, + email_recipient_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: Optional[int] = None, + time_properties_lab_vms_shutdown_properties_daily_recurrence_time: Optional[str] = None, + weekdays_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: Optional[List[str]] = None, + time_properties_lab_vms_shutdown_properties_weekly_recurrence_time: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - """ - super().__init__(tags=tags, **kwargs) + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword tags_properties_lab_vms_startup_tags: Resource tags. + :paramtype tags_properties_lab_vms_startup_tags: dict[str, str] + :keyword location_properties_lab_vms_startup_location: The geo-location where the resource + lives. + :paramtype location_properties_lab_vms_startup_location: str + :keyword status_properties_lab_vms_startup_properties_status: The status of the schedule (i.e. + Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :paramtype status_properties_lab_vms_startup_properties_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword task_type_properties_lab_vms_startup_properties_task_type: The task type of the + schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype task_type_properties_lab_vms_startup_properties_task_type: str + :keyword time_zone_id_properties_lab_vms_startup_properties_time_zone_id: The time zone ID + (e.g. Pacific Standard time). + :paramtype time_zone_id_properties_lab_vms_startup_properties_time_zone_id: str + :keyword target_resource_id_properties_lab_vms_startup_properties_target_resource_id: The + resource ID to which the schedule belongs. + :paramtype target_resource_id_properties_lab_vms_startup_properties_target_resource_id: str + :keyword status_properties_lab_vms_startup_properties_notification_settings_status: If + notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype status_properties_lab_vms_startup_properties_notification_settings_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :keyword webhook_url_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype webhook_url_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :keyword minute_properties_lab_vms_startup_properties_hourly_recurrence_minute: Minutes of the + hour the schedule will run. + :paramtype minute_properties_lab_vms_startup_properties_hourly_recurrence_minute: int + :keyword time_properties_lab_vms_startup_properties_daily_recurrence_time: The time of day the + schedule will occur. + :paramtype time_properties_lab_vms_startup_properties_daily_recurrence_time: str + :keyword weekdays_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: The days of + the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype weekdays_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: list[str] + :keyword time_properties_lab_vms_startup_properties_weekly_recurrence_time: The time of the day + the schedule will occur. + :paramtype time_properties_lab_vms_startup_properties_weekly_recurrence_time: str + :keyword tags_properties_lab_vms_shutdown_tags: Resource tags. + :paramtype tags_properties_lab_vms_shutdown_tags: dict[str, str] + :keyword location_properties_lab_vms_shutdown_location: The geo-location where the resource + lives. + :paramtype location_properties_lab_vms_shutdown_location: str + :keyword status_properties_lab_vms_shutdown_properties_status: The status of the schedule (i.e. + Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :paramtype status_properties_lab_vms_shutdown_properties_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword task_type_properties_lab_vms_shutdown_properties_task_type: The task type of the + schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype task_type_properties_lab_vms_shutdown_properties_task_type: str + :keyword time_zone_id_properties_lab_vms_shutdown_properties_time_zone_id: The time zone ID + (e.g. Pacific Standard time). + :paramtype time_zone_id_properties_lab_vms_shutdown_properties_time_zone_id: str + :keyword target_resource_id_properties_lab_vms_shutdown_properties_target_resource_id: The + resource ID to which the schedule belongs. + :paramtype target_resource_id_properties_lab_vms_shutdown_properties_target_resource_id: str + :keyword status_properties_lab_vms_shutdown_properties_notification_settings_status: If + notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype status_properties_lab_vms_shutdown_properties_notification_settings_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :keyword webhook_url_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: str + :keyword + email_recipient_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :keyword minute_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: Minutes of the + hour the schedule will run. + :paramtype minute_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: int + :keyword time_properties_lab_vms_shutdown_properties_daily_recurrence_time: The time of day the + schedule will occur. + :paramtype time_properties_lab_vms_shutdown_properties_daily_recurrence_time: str + :keyword weekdays_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: The days + of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype weekdays_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :keyword time_properties_lab_vms_shutdown_properties_weekly_recurrence_time: The time of the + day the schedule will occur. + :paramtype time_properties_lab_vms_shutdown_properties_weekly_recurrence_time: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.id_properties_lab_vms_startup_id = None + self.name_properties_lab_vms_startup_name = None + self.type_properties_lab_vms_startup_type = None + self.tags_properties_lab_vms_startup_tags = tags_properties_lab_vms_startup_tags + self.location_properties_lab_vms_startup_location = location_properties_lab_vms_startup_location + self.system_data_properties_lab_vms_startup_system_data = None + self.status_properties_lab_vms_startup_properties_status = status_properties_lab_vms_startup_properties_status + self.task_type_properties_lab_vms_startup_properties_task_type = ( + task_type_properties_lab_vms_startup_properties_task_type + ) + self.time_zone_id_properties_lab_vms_startup_properties_time_zone_id = ( + time_zone_id_properties_lab_vms_startup_properties_time_zone_id + ) + self.created_date_properties_lab_vms_startup_properties_created_date = None + self.target_resource_id_properties_lab_vms_startup_properties_target_resource_id = ( + target_resource_id_properties_lab_vms_startup_properties_target_resource_id + ) + self.provisioning_state_properties_lab_vms_startup_properties_provisioning_state = None + self.unique_identifier_properties_lab_vms_startup_properties_unique_identifier = None + self.status_properties_lab_vms_startup_properties_notification_settings_status = ( + status_properties_lab_vms_startup_properties_notification_settings_status + ) + self.time_in_minutes_properties_lab_vms_startup_properties_notification_settings_time_in_minutes = ( + time_in_minutes_properties_lab_vms_startup_properties_notification_settings_time_in_minutes + ) + self.webhook_url_properties_lab_vms_startup_properties_notification_settings_webhook_url = ( + webhook_url_properties_lab_vms_startup_properties_notification_settings_webhook_url + ) + self.email_recipient_properties_lab_vms_startup_properties_notification_settings_email_recipient = ( + email_recipient_properties_lab_vms_startup_properties_notification_settings_email_recipient + ) + self.notification_locale_properties_lab_vms_startup_properties_notification_settings_notification_locale = ( + notification_locale_properties_lab_vms_startup_properties_notification_settings_notification_locale + ) + self.minute_properties_lab_vms_startup_properties_hourly_recurrence_minute = ( + minute_properties_lab_vms_startup_properties_hourly_recurrence_minute + ) + self.time_properties_lab_vms_startup_properties_daily_recurrence_time = ( + time_properties_lab_vms_startup_properties_daily_recurrence_time + ) + self.weekdays_properties_lab_vms_startup_properties_weekly_recurrence_weekdays = ( + weekdays_properties_lab_vms_startup_properties_weekly_recurrence_weekdays + ) + self.time_properties_lab_vms_startup_properties_weekly_recurrence_time = ( + time_properties_lab_vms_startup_properties_weekly_recurrence_time + ) + self.id_properties_lab_vms_shutdown_id = None + self.name_properties_lab_vms_shutdown_name = None + self.type_properties_lab_vms_shutdown_type = None + self.tags_properties_lab_vms_shutdown_tags = tags_properties_lab_vms_shutdown_tags + self.location_properties_lab_vms_shutdown_location = location_properties_lab_vms_shutdown_location + self.system_data_properties_lab_vms_shutdown_system_data = None + self.status_properties_lab_vms_shutdown_properties_status = status_properties_lab_vms_shutdown_properties_status + self.task_type_properties_lab_vms_shutdown_properties_task_type = ( + task_type_properties_lab_vms_shutdown_properties_task_type + ) + self.time_zone_id_properties_lab_vms_shutdown_properties_time_zone_id = ( + time_zone_id_properties_lab_vms_shutdown_properties_time_zone_id + ) + self.created_date_properties_lab_vms_shutdown_properties_created_date = None + self.target_resource_id_properties_lab_vms_shutdown_properties_target_resource_id = ( + target_resource_id_properties_lab_vms_shutdown_properties_target_resource_id + ) + self.provisioning_state_properties_lab_vms_shutdown_properties_provisioning_state = None + self.unique_identifier_properties_lab_vms_shutdown_properties_unique_identifier = None + self.status_properties_lab_vms_shutdown_properties_notification_settings_status = ( + status_properties_lab_vms_shutdown_properties_notification_settings_status + ) + self.time_in_minutes_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes = ( + time_in_minutes_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes + ) + self.webhook_url_properties_lab_vms_shutdown_properties_notification_settings_webhook_url = ( + webhook_url_properties_lab_vms_shutdown_properties_notification_settings_webhook_url + ) + self.email_recipient_properties_lab_vms_shutdown_properties_notification_settings_email_recipient = ( + email_recipient_properties_lab_vms_shutdown_properties_notification_settings_email_recipient + ) + self.notification_locale_properties_lab_vms_shutdown_properties_notification_settings_notification_locale = ( + notification_locale_properties_lab_vms_shutdown_properties_notification_settings_notification_locale + ) + self.minute_properties_lab_vms_shutdown_properties_hourly_recurrence_minute = ( + minute_properties_lab_vms_shutdown_properties_hourly_recurrence_minute + ) + self.time_properties_lab_vms_shutdown_properties_daily_recurrence_time = ( + time_properties_lab_vms_shutdown_properties_daily_recurrence_time + ) + self.weekdays_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays = ( + weekdays_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays + ) + self.time_properties_lab_vms_shutdown_properties_weekly_recurrence_time = ( + time_properties_lab_vms_shutdown_properties_weekly_recurrence_time + ) class ApplyArtifactsRequest(_serialization.Model): @@ -185,7 +715,7 @@ class ApplyArtifactsRequest(_serialization.Model): "artifacts": {"key": "artifacts", "type": "[ArtifactInstallProperties]"}, } - def __init__(self, *, artifacts: Optional[List["_models.ArtifactInstallProperties"]] = None, **kwargs): + def __init__(self, *, artifacts: Optional[List["_models.ArtifactInstallProperties"]] = None, **kwargs: Any) -> None: """ :keyword artifacts: The list of artifacts to apply. :paramtype artifacts: list[~azure.mgmt.devtestlabs.models.ArtifactInstallProperties] @@ -199,16 +729,22 @@ class ArmTemplate(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar display_name: The display name of the ARM template. :vartype display_name: str :ivar description: The description of the ARM template. @@ -233,6 +769,8 @@ class ArmTemplate(Resource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "display_name": {"readonly": True}, "description": {"readonly": True}, "publisher": {"readonly": True}, @@ -247,8 +785,9 @@ class ArmTemplate(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "display_name": {"key": "properties.displayName", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "publisher": {"key": "properties.publisher", "type": "str"}, @@ -262,14 +801,15 @@ class ArmTemplate(Resource): # pylint: disable=too-many-instance-attributes "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.display_name = None self.description = None self.publisher = None @@ -294,7 +834,7 @@ class ArmTemplateInfo(_serialization.Model): "parameters": {"key": "parameters", "type": "object"}, } - def __init__(self, *, template: Optional[JSON] = None, parameters: Optional[JSON] = None, **kwargs): + def __init__(self, *, template: Optional[JSON] = None, parameters: Optional[JSON] = None, **kwargs: Any) -> None: """ :keyword template: The template's contents. :paramtype template: JSON @@ -307,11 +847,11 @@ def __init__(self, *, template: Optional[JSON] = None, parameters: Optional[JSON class ArmTemplateList(_serialization.Model): - """The response of a list operation. + """Contains a list of armTemplates and their properties. - :ivar value: Results of the list operation. + :ivar value: List of armTemplates and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.ArmTemplate] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -321,12 +861,12 @@ class ArmTemplateList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ArmTemplate"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.ArmTemplate"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of armTemplates and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.ArmTemplate] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -348,7 +888,7 @@ class ArmTemplateParameterProperties(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the template parameter. :paramtype name: str @@ -365,16 +905,22 @@ class Artifact(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar title: The artifact's title. :vartype title: str :ivar description: The artifact's description. @@ -397,6 +943,8 @@ class Artifact(Resource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "title": {"readonly": True}, "description": {"readonly": True}, "publisher": {"readonly": True}, @@ -411,8 +959,9 @@ class Artifact(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "title": {"key": "properties.title", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "publisher": {"key": "properties.publisher", "type": "str"}, @@ -423,14 +972,15 @@ class Artifact(Resource): # pylint: disable=too-many-instance-attributes "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.title = None self.description = None self.publisher = None @@ -441,45 +991,6 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s self.created_date = None -class ArtifactDeploymentStatusProperties(_serialization.Model): - """Properties of an artifact deployment. - - :ivar deployment_status: The deployment status of the artifact. - :vartype deployment_status: str - :ivar artifacts_applied: The total count of the artifacts that were successfully applied. - :vartype artifacts_applied: int - :ivar total_artifacts: The total count of the artifacts that were tentatively applied. - :vartype total_artifacts: int - """ - - _attribute_map = { - "deployment_status": {"key": "deploymentStatus", "type": "str"}, - "artifacts_applied": {"key": "artifactsApplied", "type": "int"}, - "total_artifacts": {"key": "totalArtifacts", "type": "int"}, - } - - def __init__( - self, - *, - deployment_status: Optional[str] = None, - artifacts_applied: Optional[int] = None, - total_artifacts: Optional[int] = None, - **kwargs - ): - """ - :keyword deployment_status: The deployment status of the artifact. - :paramtype deployment_status: str - :keyword artifacts_applied: The total count of the artifacts that were successfully applied. - :paramtype artifacts_applied: int - :keyword total_artifacts: The total count of the artifacts that were tentatively applied. - :paramtype total_artifacts: int - """ - super().__init__(**kwargs) - self.deployment_status = deployment_status - self.artifacts_applied = artifacts_applied - self.total_artifacts = total_artifacts - - class ArtifactInstallProperties(_serialization.Model): """Properties of an artifact. @@ -519,8 +1030,8 @@ def __init__( deployment_status_message: Optional[str] = None, vm_extension_status_message: Optional[str] = None, install_time: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword artifact_id: The artifact's identifier. :paramtype artifact_id: str @@ -548,11 +1059,11 @@ def __init__( class ArtifactList(_serialization.Model): - """The response of a list operation. + """Contains a list of artifacts and their properties. - :ivar value: Results of the list operation. + :ivar value: List of artifacts and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.Artifact] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -561,11 +1072,13 @@ class ArtifactList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Artifact"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Artifact"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of artifacts and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.Artifact] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -587,7 +1100,7 @@ class ArtifactParameterProperties(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the artifact parameter. :paramtype name: str @@ -604,16 +1117,22 @@ class ArtifactSource(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar display_name: The artifact source's display name. :vartype display_name: str :ivar uri: The artifact source's URI. @@ -644,6 +1163,8 @@ class ArtifactSource(Resource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "created_date": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, @@ -653,8 +1174,9 @@ class ArtifactSource(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "display_name": {"key": "properties.displayName", "type": "str"}, "uri": {"key": "properties.uri", "type": "str"}, "source_type": {"key": "properties.sourceType", "type": "str"}, @@ -671,7 +1193,7 @@ class ArtifactSource(Resource): # pylint: disable=too-many-instance-attributes def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, display_name: Optional[str] = None, uri: Optional[str] = None, @@ -681,13 +1203,13 @@ def __init__( branch_ref: Optional[str] = None, security_token: Optional[str] = None, status: Optional[Union[str, "_models.EnableStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword display_name: The artifact source's display name. :paramtype display_name: str :keyword uri: The artifact source's URI. @@ -707,7 +1229,8 @@ def __init__( values are: "Enabled" and "Disabled". :paramtype status: str or ~azure.mgmt.devtestlabs.models.EnableStatus """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.display_name = display_name self.uri = uri self.source_type = source_type @@ -721,31 +1244,74 @@ def __init__( self.unique_identifier = None +class UpdateResource(_serialization.Model): + """Represents an update resource. + + :ivar tags: The tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + + class ArtifactSourceFragment(UpdateResource): - """Properties of an artifact source. + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) class ArtifactSourceList(_serialization.Model): - """The response of a list operation. + """Contains a list of artifactSources and their properties. - :ivar value: Results of the list operation. + :ivar value: List of artifactSources and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.ArtifactSource] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -755,12 +1321,12 @@ class ArtifactSourceList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ArtifactSource"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.ArtifactSource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of artifactSources and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.ArtifactSource] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -780,7 +1346,7 @@ class AttachDiskProperties(_serialization.Model): "leased_by_lab_vm_id": {"key": "leasedByLabVmId", "type": "str"}, } - def __init__(self, *, leased_by_lab_vm_id: Optional[str] = None, **kwargs): + def __init__(self, *, leased_by_lab_vm_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword leased_by_lab_vm_id: The resource ID of the Lab virtual machine to which the disk is attached. @@ -790,65 +1356,135 @@ def __init__(self, *, leased_by_lab_vm_id: Optional[str] = None, **kwargs): self.leased_by_lab_vm_id = leased_by_lab_vm_id -class AttachNewDataDiskOptions(_serialization.Model): - """Properties to attach new disk to the Virtual Machine. +class BastionHost(Resource): + """Profile of a Bastion Host. - :ivar disk_size_gi_b: Size of the disk to be attached in Gibibytes. - :vartype disk_size_gi_b: int - :ivar disk_name: The name of the disk to be attached. - :vartype disk_name: str - :ivar disk_type: The storage type for the disk (i.e. Standard, Premium). Known values are: - "Standard", "Premium", and "StandardSSD". - :vartype disk_type: str or ~azure.mgmt.devtestlabs.models.StorageType + 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar external_bastion_host_id: The ID of the external BastionHost resource that corresponds to + this DTL BastionHost. + :vartype external_bastion_host_id: str + :ivar ip_address_id: The ID of the PublicIpAddress resource that is created by and paired with + this BastionHost. + :vartype ip_address_id: str + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :ivar unique_identifier: The unique immutable identifier of a resource (Guid). + :vartype unique_identifier: str """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "external_bastion_host_id": {"readonly": True}, + "ip_address_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "unique_identifier": {"readonly": True}, + } + _attribute_map = { - "disk_size_gi_b": {"key": "diskSizeGiB", "type": "int"}, - "disk_name": {"key": "diskName", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, + "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"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "external_bastion_host_id": {"key": "properties.externalBastionHostId", "type": "str"}, + "ip_address_id": {"key": "properties.ipAddressId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, } - def __init__( - self, - *, - disk_size_gi_b: Optional[int] = None, - disk_name: Optional[str] = None, - disk_type: Optional[Union[str, "_models.StorageType"]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword disk_size_gi_b: Size of the disk to be attached in Gibibytes. - :paramtype disk_size_gi_b: int - :keyword disk_name: The name of the disk to be attached. - :paramtype disk_name: str - :keyword disk_type: The storage type for the disk (i.e. Standard, Premium). Known values are: - "Standard", "Premium", and "StandardSSD". - :paramtype disk_type: str or ~azure.mgmt.devtestlabs.models.StorageType + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ - super().__init__(**kwargs) - self.disk_size_gi_b = disk_size_gi_b - self.disk_name = disk_name - self.disk_type = disk_type + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.external_bastion_host_id = None + self.ip_address_id = None + self.provisioning_state = None + self.unique_identifier = None -class BulkCreationParameters(_serialization.Model): - """Parameters for creating multiple virtual machines as a single action. +class BastionHostFragment(UpdateResource): + """Patch. - :ivar instance_count: The number of virtual machine instances to create. - :vartype instance_count: int + :ivar tags: The tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { - "instance_count": {"key": "instanceCount", "type": "int"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, instance_count: Optional[int] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword instance_count: The number of virtual machine instances to create. - :paramtype instance_count: int + :keyword tags: The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + """ + super().__init__(tags=tags, identity=identity, **kwargs) + + +class BastionHostList(_serialization.Model): + """Contains a list of bastionHosts and their properties. + + :ivar value: List of bastionHosts and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.BastionHost] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[BastionHost]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.BastionHost"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of bastionHosts and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.BastionHost] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.instance_count = instance_count + self.value = value + self.next_link = next_link class CloudErrorBody(_serialization.Model): @@ -878,8 +1514,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: The error code. :paramtype code: str @@ -925,8 +1561,8 @@ def __init__( disk_uri: Optional[str] = None, managed_disk_id: Optional[str] = None, disk_size_gi_b: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets data disk name. :paramtype name: str @@ -968,8 +1604,8 @@ def __init__( code: Optional[str] = None, display_status: Optional[str] = None, message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Gets the status Code. :paramtype code: str @@ -984,154 +1620,27 @@ def __init__( self.message = message -class ComputeVmProperties(_serialization.Model): - """Properties of a virtual machine returned by the Microsoft.Compute API. - - :ivar statuses: Gets the statuses of the virtual machine. - :vartype statuses: list[~azure.mgmt.devtestlabs.models.ComputeVmInstanceViewStatus] - :ivar os_type: Gets the OS type of the virtual machine. - :vartype os_type: str - :ivar vm_size: Gets the size of the virtual machine. - :vartype vm_size: str - :ivar network_interface_id: Gets the network interface ID of the virtual machine. - :vartype network_interface_id: str - :ivar os_disk_id: Gets OS disk blob uri for the virtual machine. - :vartype os_disk_id: str - :ivar data_disk_ids: Gets data disks blob uri for the virtual machine. - :vartype data_disk_ids: list[str] - :ivar data_disks: Gets all data disks attached to the virtual machine. - :vartype data_disks: list[~azure.mgmt.devtestlabs.models.ComputeDataDisk] - """ - - _attribute_map = { - "statuses": {"key": "statuses", "type": "[ComputeVmInstanceViewStatus]"}, - "os_type": {"key": "osType", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "network_interface_id": {"key": "networkInterfaceId", "type": "str"}, - "os_disk_id": {"key": "osDiskId", "type": "str"}, - "data_disk_ids": {"key": "dataDiskIds", "type": "[str]"}, - "data_disks": {"key": "dataDisks", "type": "[ComputeDataDisk]"}, - } - - def __init__( - self, - *, - statuses: Optional[List["_models.ComputeVmInstanceViewStatus"]] = None, - os_type: Optional[str] = None, - vm_size: Optional[str] = None, - network_interface_id: Optional[str] = None, - os_disk_id: Optional[str] = None, - data_disk_ids: Optional[List[str]] = None, - data_disks: Optional[List["_models.ComputeDataDisk"]] = None, - **kwargs - ): - """ - :keyword statuses: Gets the statuses of the virtual machine. - :paramtype statuses: list[~azure.mgmt.devtestlabs.models.ComputeVmInstanceViewStatus] - :keyword os_type: Gets the OS type of the virtual machine. - :paramtype os_type: str - :keyword vm_size: Gets the size of the virtual machine. - :paramtype vm_size: str - :keyword network_interface_id: Gets the network interface ID of the virtual machine. - :paramtype network_interface_id: str - :keyword os_disk_id: Gets OS disk blob uri for the virtual machine. - :paramtype os_disk_id: str - :keyword data_disk_ids: Gets data disks blob uri for the virtual machine. - :paramtype data_disk_ids: list[str] - :keyword data_disks: Gets all data disks attached to the virtual machine. - :paramtype data_disks: list[~azure.mgmt.devtestlabs.models.ComputeDataDisk] - """ - super().__init__(**kwargs) - self.statuses = statuses - self.os_type = os_type - self.vm_size = vm_size - self.network_interface_id = network_interface_id - self.os_disk_id = os_disk_id - self.data_disk_ids = data_disk_ids - self.data_disks = data_disks - - -class CostThresholdProperties(_serialization.Model): - """Properties of a cost threshold item. - - :ivar threshold_id: The ID of the cost threshold item. - :vartype threshold_id: str - :ivar percentage_threshold: The value of the percentage cost threshold. - :vartype percentage_threshold: ~azure.mgmt.devtestlabs.models.PercentageCostThresholdProperties - :ivar display_on_chart: Indicates whether this threshold will be displayed on cost charts. - Known values are: "Enabled" and "Disabled". - :vartype display_on_chart: str or ~azure.mgmt.devtestlabs.models.CostThresholdStatus - :ivar send_notification_when_exceeded: Indicates whether notifications will be sent when this - threshold is exceeded. Known values are: "Enabled" and "Disabled". - :vartype send_notification_when_exceeded: str or - ~azure.mgmt.devtestlabs.models.CostThresholdStatus - :ivar notification_sent: Indicates the datetime when notifications were last sent for this - threshold. - :vartype notification_sent: str - """ - - _attribute_map = { - "threshold_id": {"key": "thresholdId", "type": "str"}, - "percentage_threshold": {"key": "percentageThreshold", "type": "PercentageCostThresholdProperties"}, - "display_on_chart": {"key": "displayOnChart", "type": "str"}, - "send_notification_when_exceeded": {"key": "sendNotificationWhenExceeded", "type": "str"}, - "notification_sent": {"key": "notificationSent", "type": "str"}, - } - - def __init__( - self, - *, - threshold_id: Optional[str] = None, - percentage_threshold: Optional["_models.PercentageCostThresholdProperties"] = None, - display_on_chart: Optional[Union[str, "_models.CostThresholdStatus"]] = None, - send_notification_when_exceeded: Optional[Union[str, "_models.CostThresholdStatus"]] = None, - notification_sent: Optional[str] = None, - **kwargs - ): - """ - :keyword threshold_id: The ID of the cost threshold item. - :paramtype threshold_id: str - :keyword percentage_threshold: The value of the percentage cost threshold. - :paramtype percentage_threshold: - ~azure.mgmt.devtestlabs.models.PercentageCostThresholdProperties - :keyword display_on_chart: Indicates whether this threshold will be displayed on cost charts. - Known values are: "Enabled" and "Disabled". - :paramtype display_on_chart: str or ~azure.mgmt.devtestlabs.models.CostThresholdStatus - :keyword send_notification_when_exceeded: Indicates whether notifications will be sent when - this threshold is exceeded. Known values are: "Enabled" and "Disabled". - :paramtype send_notification_when_exceeded: str or - ~azure.mgmt.devtestlabs.models.CostThresholdStatus - :keyword notification_sent: Indicates the datetime when notifications were last sent for this - threshold. - :paramtype notification_sent: str - """ - super().__init__(**kwargs) - self.threshold_id = threshold_id - self.percentage_threshold = percentage_threshold - self.display_on_chart = display_on_chart - self.send_notification_when_exceeded = send_notification_when_exceeded - self.notification_sent = notification_sent - - class CustomImage(Resource): # pylint: disable=too-many-instance-attributes """A custom image. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar vm: The virtual machine from which the image is to be created. - :vartype vm: ~azure.mgmt.devtestlabs.models.CustomImagePropertiesFromVm - :ivar vhd: The VHD from which the image is to be created. - :vartype vhd: ~azure.mgmt.devtestlabs.models.CustomImagePropertiesCustom + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar description: The description of the custom image. :vartype description: str :ivar author: The author of the custom image. @@ -1145,8 +1654,6 @@ class CustomImage(Resource): # pylint: disable=too-many-instance-attributes :ivar data_disk_storage_info: Storage information about the data disks present in the custom image. :vartype data_disk_storage_info: list[~azure.mgmt.devtestlabs.models.DataDiskStorageTypeInfo] - :ivar custom_image_plan: Storage information about the plan related to this custom image. - :vartype custom_image_plan: ~azure.mgmt.devtestlabs.models.CustomImagePropertiesFromPlan :ivar is_plan_authorized: Whether or not the custom images underlying offer/plan has been enabled for programmatic deployment. :vartype is_plan_authorized: bool @@ -1154,12 +1661,38 @@ class CustomImage(Resource): # pylint: disable=too-many-instance-attributes :vartype provisioning_state: str :ivar unique_identifier: The unique immutable identifier of a resource (Guid). :vartype unique_identifier: str + :ivar id_properties_custom_image_plan_id: The id of the plan, equivalent to name of the plan. + :vartype id_properties_custom_image_plan_id: str + :ivar publisher: The publisher for the plan from the marketplace image the custom image is + derived from. + :vartype publisher: str + :ivar offer: The offer for the plan from the marketplace image the custom image is derived + from. + :vartype offer: str + :ivar image_name: The image name. + :vartype image_name: str + :ivar sys_prep: Indicates whether sysprep has been run on the VHD. + :vartype sys_prep: bool + :ivar os_type: The OS type of the custom image (i.e. Windows, Linux). Known values are: + "Windows", "Linux", and "None". + :vartype os_type: str or ~azure.mgmt.devtestlabs.models.CustomImageOsType + :ivar source_vm_id: The source vm identifier. + :vartype source_vm_id: str + :ivar linux_os_state: The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, + DeprovisionApplied). Known values are: "NonDeprovisioned", "DeprovisionRequested", and + "DeprovisionApplied". + :vartype linux_os_state: str or ~azure.mgmt.devtestlabs.models.LinuxOsState + :ivar windows_os_state: The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, + SysprepApplied). Known values are: "NonSysprepped", "SysprepRequested", and "SysprepApplied". + :vartype windows_os_state: str or ~azure.mgmt.devtestlabs.models.WindowsOsState """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "creation_date": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, @@ -1169,47 +1702,56 @@ class CustomImage(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "vm": {"key": "properties.vm", "type": "CustomImagePropertiesFromVm"}, - "vhd": {"key": "properties.vhd", "type": "CustomImagePropertiesCustom"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "description": {"key": "properties.description", "type": "str"}, "author": {"key": "properties.author", "type": "str"}, "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, "managed_image_id": {"key": "properties.managedImageId", "type": "str"}, "managed_snapshot_id": {"key": "properties.managedSnapshotId", "type": "str"}, "data_disk_storage_info": {"key": "properties.dataDiskStorageInfo", "type": "[DataDiskStorageTypeInfo]"}, - "custom_image_plan": {"key": "properties.customImagePlan", "type": "CustomImagePropertiesFromPlan"}, "is_plan_authorized": {"key": "properties.isPlanAuthorized", "type": "bool"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "id_properties_custom_image_plan_id": {"key": "properties.customImagePlan.id", "type": "str"}, + "publisher": {"key": "properties.customImagePlan.publisher", "type": "str"}, + "offer": {"key": "properties.customImagePlan.offer", "type": "str"}, + "image_name": {"key": "properties.vhd.imageName", "type": "str"}, + "sys_prep": {"key": "properties.vhd.sysPrep", "type": "bool"}, + "os_type": {"key": "properties.vhd.osType", "type": "str"}, + "source_vm_id": {"key": "properties.vm.sourceVmId", "type": "str"}, + "linux_os_state": {"key": "properties.vm.linuxOsInfo.linuxOsState", "type": "str"}, + "windows_os_state": {"key": "properties.vm.windowsOsInfo.windowsOsState", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - vm: Optional["_models.CustomImagePropertiesFromVm"] = None, - vhd: Optional["_models.CustomImagePropertiesCustom"] = None, description: Optional[str] = None, author: Optional[str] = None, managed_image_id: Optional[str] = None, managed_snapshot_id: Optional[str] = None, data_disk_storage_info: Optional[List["_models.DataDiskStorageTypeInfo"]] = None, - custom_image_plan: Optional["_models.CustomImagePropertiesFromPlan"] = None, is_plan_authorized: Optional[bool] = None, - **kwargs - ): + id_properties_custom_image_plan_id: Optional[str] = None, + publisher: Optional[str] = None, + offer: Optional[str] = None, + image_name: Optional[str] = None, + sys_prep: Optional[bool] = None, + os_type: Optional[Union[str, "_models.CustomImageOsType"]] = None, + source_vm_id: Optional[str] = None, + linux_os_state: Optional[Union[str, "_models.LinuxOsState"]] = None, + windows_os_state: Optional[Union[str, "_models.WindowsOsState"]] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword vm: The virtual machine from which the image is to be created. - :paramtype vm: ~azure.mgmt.devtestlabs.models.CustomImagePropertiesFromVm - :keyword vhd: The VHD from which the image is to be created. - :paramtype vhd: ~azure.mgmt.devtestlabs.models.CustomImagePropertiesCustom + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword description: The description of the custom image. :paramtype description: str :keyword author: The author of the custom image. @@ -1221,52 +1763,93 @@ def __init__( :keyword data_disk_storage_info: Storage information about the data disks present in the custom image. :paramtype data_disk_storage_info: list[~azure.mgmt.devtestlabs.models.DataDiskStorageTypeInfo] - :keyword custom_image_plan: Storage information about the plan related to this custom image. - :paramtype custom_image_plan: ~azure.mgmt.devtestlabs.models.CustomImagePropertiesFromPlan :keyword is_plan_authorized: Whether or not the custom images underlying offer/plan has been enabled for programmatic deployment. :paramtype is_plan_authorized: bool + :keyword id_properties_custom_image_plan_id: The id of the plan, equivalent to name of the + plan. + :paramtype id_properties_custom_image_plan_id: str + :keyword publisher: The publisher for the plan from the marketplace image the custom image is + derived from. + :paramtype publisher: str + :keyword offer: The offer for the plan from the marketplace image the custom image is derived + from. + :paramtype offer: str + :keyword image_name: The image name. + :paramtype image_name: str + :keyword sys_prep: Indicates whether sysprep has been run on the VHD. + :paramtype sys_prep: bool + :keyword os_type: The OS type of the custom image (i.e. Windows, Linux). Known values are: + "Windows", "Linux", and "None". + :paramtype os_type: str or ~azure.mgmt.devtestlabs.models.CustomImageOsType + :keyword source_vm_id: The source vm identifier. + :paramtype source_vm_id: str + :keyword linux_os_state: The state of the Linux OS (i.e. NonDeprovisioned, + DeprovisionRequested, DeprovisionApplied). Known values are: "NonDeprovisioned", + "DeprovisionRequested", and "DeprovisionApplied". + :paramtype linux_os_state: str or ~azure.mgmt.devtestlabs.models.LinuxOsState + :keyword windows_os_state: The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, + SysprepApplied). Known values are: "NonSysprepped", "SysprepRequested", and "SysprepApplied". + :paramtype windows_os_state: str or ~azure.mgmt.devtestlabs.models.WindowsOsState """ - super().__init__(location=location, tags=tags, **kwargs) - self.vm = vm - self.vhd = vhd + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.description = description self.author = author self.creation_date = None self.managed_image_id = managed_image_id self.managed_snapshot_id = managed_snapshot_id self.data_disk_storage_info = data_disk_storage_info - self.custom_image_plan = custom_image_plan self.is_plan_authorized = is_plan_authorized self.provisioning_state = None self.unique_identifier = None + self.id_properties_custom_image_plan_id = id_properties_custom_image_plan_id + self.publisher = publisher + self.offer = offer + self.image_name = image_name + self.sys_prep = sys_prep + self.os_type = os_type + self.source_vm_id = source_vm_id + self.linux_os_state = linux_os_state + self.windows_os_state = windows_os_state class CustomImageFragment(UpdateResource): - """A custom image. + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) class CustomImageList(_serialization.Model): - """The response of a list operation. + """Contains a list of customImages and their properties. - :ivar value: Results of the list operation. + :ivar value: List of customImages and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.CustomImage] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1276,12 +1859,12 @@ class CustomImageList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.CustomImage"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.CustomImage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of customImages and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.CustomImage] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1289,54 +1872,7 @@ def __init__( self.next_link = next_link -class CustomImagePropertiesCustom(_serialization.Model): - """Properties for creating a custom image from a VHD. - - All required parameters must be populated in order to send to Azure. - - :ivar image_name: The image name. - :vartype image_name: str - :ivar sys_prep: Indicates whether sysprep has been run on the VHD. - :vartype sys_prep: bool - :ivar os_type: The OS type of the custom image (i.e. Windows, Linux). Required. Known values - are: "Windows", "Linux", and "None". - :vartype os_type: str or ~azure.mgmt.devtestlabs.models.CustomImageOsType - """ - - _validation = { - "os_type": {"required": True}, - } - - _attribute_map = { - "image_name": {"key": "imageName", "type": "str"}, - "sys_prep": {"key": "sysPrep", "type": "bool"}, - "os_type": {"key": "osType", "type": "str"}, - } - - def __init__( - self, - *, - os_type: Union[str, "_models.CustomImageOsType"], - image_name: Optional[str] = None, - sys_prep: Optional[bool] = None, - **kwargs - ): - """ - :keyword image_name: The image name. - :paramtype image_name: str - :keyword sys_prep: Indicates whether sysprep has been run on the VHD. - :paramtype sys_prep: bool - :keyword os_type: The OS type of the custom image (i.e. Windows, Linux). Required. Known values - are: "Windows", "Linux", and "None". - :paramtype os_type: str or ~azure.mgmt.devtestlabs.models.CustomImageOsType - """ - super().__init__(**kwargs) - self.image_name = image_name - self.sys_prep = sys_prep - self.os_type = os_type - - -class CustomImagePropertiesFromPlan(_serialization.Model): +class CustomImagePropertiesFromPlanFragment(_serialization.Model): """Properties for plan on a custom image. :ivar id: The id of the plan, equivalent to name of the plan. @@ -1361,8 +1897,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin publisher: Optional[str] = None, offer: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the plan, equivalent to name of the plan. :paramtype id: str @@ -1379,87 +1915,61 @@ def __init__( self.offer = offer -class CustomImagePropertiesFromVm(_serialization.Model): - """Properties for creating a custom image from a virtual machine. - - :ivar source_vm_id: The source vm identifier. - :vartype source_vm_id: str - :ivar windows_os_info: The Windows OS information of the VM. - :vartype windows_os_info: ~azure.mgmt.devtestlabs.models.WindowsOsInfo - :ivar linux_os_info: The Linux OS information of the VM. - :vartype linux_os_info: ~azure.mgmt.devtestlabs.models.LinuxOsInfo - """ - - _attribute_map = { - "source_vm_id": {"key": "sourceVmId", "type": "str"}, - "windows_os_info": {"key": "windowsOsInfo", "type": "WindowsOsInfo"}, - "linux_os_info": {"key": "linuxOsInfo", "type": "LinuxOsInfo"}, - } - - def __init__( - self, - *, - source_vm_id: Optional[str] = None, - windows_os_info: Optional["_models.WindowsOsInfo"] = None, - linux_os_info: Optional["_models.LinuxOsInfo"] = None, - **kwargs - ): - """ - :keyword source_vm_id: The source vm identifier. - :paramtype source_vm_id: str - :keyword windows_os_info: The Windows OS information of the VM. - :paramtype windows_os_info: ~azure.mgmt.devtestlabs.models.WindowsOsInfo - :keyword linux_os_info: The Linux OS information of the VM. - :paramtype linux_os_info: ~azure.mgmt.devtestlabs.models.LinuxOsInfo - """ - super().__init__(**kwargs) - self.source_vm_id = source_vm_id - self.windows_os_info = windows_os_info - self.linux_os_info = linux_os_info - - class DataDiskProperties(_serialization.Model): """Request body for adding a new or existing data disk to a virtual machine. - :ivar attach_new_data_disk_options: Specifies options to attach a new disk to the virtual - machine. - :vartype attach_new_data_disk_options: ~azure.mgmt.devtestlabs.models.AttachNewDataDiskOptions :ivar existing_lab_disk_id: Specifies the existing lab disk id to attach to virtual machine. :vartype existing_lab_disk_id: str :ivar host_caching: Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). Known values are: "None", "ReadOnly", and "ReadWrite". :vartype host_caching: str or ~azure.mgmt.devtestlabs.models.HostCachingOptions + :ivar disk_size_gi_b: Size of the disk to be attached in Gibibytes. + :vartype disk_size_gi_b: int + :ivar disk_name: The name of the disk to be attached. + :vartype disk_name: str + :ivar disk_type: The storage type for the disk (i.e. Standard, Premium). Known values are: + "Standard", "Premium", and "StandardSSD". + :vartype disk_type: str or ~azure.mgmt.devtestlabs.models.StorageType """ _attribute_map = { - "attach_new_data_disk_options": {"key": "attachNewDataDiskOptions", "type": "AttachNewDataDiskOptions"}, "existing_lab_disk_id": {"key": "existingLabDiskId", "type": "str"}, "host_caching": {"key": "hostCaching", "type": "str"}, + "disk_size_gi_b": {"key": "attachNewDataDiskOptions.diskSizeGiB", "type": "int"}, + "disk_name": {"key": "attachNewDataDiskOptions.diskName", "type": "str"}, + "disk_type": {"key": "attachNewDataDiskOptions.diskType", "type": "str"}, } def __init__( self, *, - attach_new_data_disk_options: Optional["_models.AttachNewDataDiskOptions"] = None, existing_lab_disk_id: Optional[str] = None, host_caching: Optional[Union[str, "_models.HostCachingOptions"]] = None, - **kwargs - ): + disk_size_gi_b: Optional[int] = None, + disk_name: Optional[str] = None, + disk_type: Optional[Union[str, "_models.StorageType"]] = None, + **kwargs: Any + ) -> None: """ - :keyword attach_new_data_disk_options: Specifies options to attach a new disk to the virtual - machine. - :paramtype attach_new_data_disk_options: - ~azure.mgmt.devtestlabs.models.AttachNewDataDiskOptions :keyword existing_lab_disk_id: Specifies the existing lab disk id to attach to virtual machine. :paramtype existing_lab_disk_id: str :keyword host_caching: Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). Known values are: "None", "ReadOnly", and "ReadWrite". :paramtype host_caching: str or ~azure.mgmt.devtestlabs.models.HostCachingOptions + :keyword disk_size_gi_b: Size of the disk to be attached in Gibibytes. + :paramtype disk_size_gi_b: int + :keyword disk_name: The name of the disk to be attached. + :paramtype disk_name: str + :keyword disk_type: The storage type for the disk (i.e. Standard, Premium). Known values are: + "Standard", "Premium", and "StandardSSD". + :paramtype disk_type: str or ~azure.mgmt.devtestlabs.models.StorageType """ super().__init__(**kwargs) - self.attach_new_data_disk_options = attach_new_data_disk_options self.existing_lab_disk_id = existing_lab_disk_id self.host_caching = host_caching + self.disk_size_gi_b = disk_size_gi_b + self.disk_name = disk_name + self.disk_type = disk_type class DataDiskStorageTypeInfo(_serialization.Model): @@ -1478,8 +1988,12 @@ class DataDiskStorageTypeInfo(_serialization.Model): } def __init__( - self, *, lun: Optional[str] = None, storage_type: Optional[Union[str, "_models.StorageType"]] = None, **kwargs - ): + self, + *, + lun: Optional[str] = None, + storage_type: Optional[Union[str, "_models.StorageType"]] = None, + **kwargs: Any + ) -> None: """ :keyword lun: Disk Lun. :paramtype lun: str @@ -1492,26 +2006,6 @@ def __init__( self.storage_type = storage_type -class DayDetails(_serialization.Model): - """Properties of a daily schedule. - - :ivar time: The time of day the schedule will occur. - :vartype time: str - """ - - _attribute_map = { - "time": {"key": "time", "type": "str"}, - } - - def __init__(self, *, time: Optional[str] = None, **kwargs): - """ - :keyword time: The time of day the schedule will occur. - :paramtype time: str - """ - super().__init__(**kwargs) - self.time = time - - class DetachDataDiskProperties(_serialization.Model): """Request body for detaching data disk from a virtual machine. @@ -1523,7 +2017,7 @@ class DetachDataDiskProperties(_serialization.Model): "existing_lab_disk_id": {"key": "existingLabDiskId", "type": "str"}, } - def __init__(self, *, existing_lab_disk_id: Optional[str] = None, **kwargs): + def __init__(self, *, existing_lab_disk_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword existing_lab_disk_id: Specifies the disk resource ID to detach from virtual machine. :paramtype existing_lab_disk_id: str @@ -1543,7 +2037,7 @@ class DetachDiskProperties(_serialization.Model): "leased_by_lab_vm_id": {"key": "leasedByLabVmId", "type": "str"}, } - def __init__(self, *, leased_by_lab_vm_id: Optional[str] = None, **kwargs): + def __init__(self, *, leased_by_lab_vm_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword leased_by_lab_vm_id: The resource ID of the Lab VM to which the disk is attached. :paramtype leased_by_lab_vm_id: str @@ -1557,16 +2051,22 @@ class Disk(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar disk_type: The storage type for the disk (i.e. Standard, Premium). Known values are: "Standard", "Premium", and "StandardSSD". :vartype disk_type: str or ~azure.mgmt.devtestlabs.models.StorageType @@ -1597,6 +2097,8 @@ class Disk(Resource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "created_date": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, @@ -1606,8 +2108,9 @@ class Disk(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "disk_type": {"key": "properties.diskType", "type": "str"}, "disk_size_gi_b": {"key": "properties.diskSizeGiB", "type": "int"}, "leased_by_lab_vm_id": {"key": "properties.leasedByLabVmId", "type": "str"}, @@ -1624,7 +2127,7 @@ class Disk(Resource): # pylint: disable=too-many-instance-attributes def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, disk_type: Optional[Union[str, "_models.StorageType"]] = None, disk_size_gi_b: Optional[int] = None, @@ -1634,13 +2137,13 @@ def __init__( storage_account_id: Optional[str] = None, host_caching: Optional[str] = None, managed_disk_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword disk_type: The storage type for the disk (i.e. Standard, Premium). Known values are: "Standard", "Premium", and "StandardSSD". :paramtype disk_type: str or ~azure.mgmt.devtestlabs.models.StorageType @@ -1660,7 +2163,8 @@ def __init__( resource. :paramtype managed_disk_id: str """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.disk_type = disk_type self.disk_size_gi_b = disk_size_gi_b self.leased_by_lab_vm_id = leased_by_lab_vm_id @@ -1675,30 +2179,41 @@ def __init__( class DiskFragment(UpdateResource): - """A Disk. + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) class DiskList(_serialization.Model): - """The response of a list operation. + """Contains a list of disks and their properties. - :ivar value: Results of the list operation. + :ivar value: List of disks and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.Disk] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1707,11 +2222,13 @@ class DiskList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Disk"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Disk"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of disks and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.Disk] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1724,18 +2241,22 @@ class DtlEnvironment(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar deployment_properties: The deployment properties of the environment. - :vartype deployment_properties: ~azure.mgmt.devtestlabs.models.EnvironmentDeploymentProperties + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar arm_template_display_name: The display name of the Azure Resource Manager template that produced the environment. :vartype arm_template_display_name: str @@ -1748,12 +2269,18 @@ class DtlEnvironment(Resource): # pylint: disable=too-many-instance-attributes :vartype provisioning_state: str :ivar unique_identifier: The unique immutable identifier of a resource (Guid). :vartype unique_identifier: str + :ivar arm_template_id: The Azure Resource Manager template's identifier. + :vartype arm_template_id: str + :ivar parameters: The parameters of the Azure Resource Manager template. + :vartype parameters: list[~azure.mgmt.devtestlabs.models.ArmTemplateParameterProperties] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "resource_group_id": {"readonly": True}, "created_by_user": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -1764,71 +2291,88 @@ class DtlEnvironment(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "deployment_properties": {"key": "properties.deploymentProperties", "type": "EnvironmentDeploymentProperties"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "arm_template_display_name": {"key": "properties.armTemplateDisplayName", "type": "str"}, "resource_group_id": {"key": "properties.resourceGroupId", "type": "str"}, "created_by_user": {"key": "properties.createdByUser", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "arm_template_id": {"key": "properties.deploymentProperties.armTemplateId", "type": "str"}, + "parameters": {"key": "properties.deploymentProperties.parameters", "type": "[ArmTemplateParameterProperties]"}, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - deployment_properties: Optional["_models.EnvironmentDeploymentProperties"] = None, arm_template_display_name: Optional[str] = None, - **kwargs - ): + arm_template_id: Optional[str] = None, + parameters: Optional[List["_models.ArmTemplateParameterProperties"]] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword deployment_properties: The deployment properties of the environment. - :paramtype deployment_properties: - ~azure.mgmt.devtestlabs.models.EnvironmentDeploymentProperties + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword arm_template_display_name: The display name of the Azure Resource Manager template that produced the environment. :paramtype arm_template_display_name: str + :keyword arm_template_id: The Azure Resource Manager template's identifier. + :paramtype arm_template_id: str + :keyword parameters: The parameters of the Azure Resource Manager template. + :paramtype parameters: list[~azure.mgmt.devtestlabs.models.ArmTemplateParameterProperties] """ - super().__init__(location=location, tags=tags, **kwargs) - self.deployment_properties = deployment_properties + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.arm_template_display_name = arm_template_display_name self.resource_group_id = None self.created_by_user = None self.provisioning_state = None self.unique_identifier = None + self.arm_template_id = arm_template_id + self.parameters = parameters class DtlEnvironmentFragment(UpdateResource): - """An environment, which is essentially an ARM template deployment. + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) class DtlEnvironmentList(_serialization.Model): - """The response of a list operation. + """Contains a list of environments and their properties. - :ivar value: Results of the list operation. + :ivar value: List of environments and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.DtlEnvironment] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1838,12 +2382,12 @@ class DtlEnvironmentList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DtlEnvironment"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.DtlEnvironment"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of environments and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.DtlEnvironment] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1851,38 +2395,6 @@ def __init__( self.next_link = next_link -class EnvironmentDeploymentProperties(_serialization.Model): - """Properties of an environment deployment. - - :ivar arm_template_id: The Azure Resource Manager template's identifier. - :vartype arm_template_id: str - :ivar parameters: The parameters of the Azure Resource Manager template. - :vartype parameters: list[~azure.mgmt.devtestlabs.models.ArmTemplateParameterProperties] - """ - - _attribute_map = { - "arm_template_id": {"key": "armTemplateId", "type": "str"}, - "parameters": {"key": "parameters", "type": "[ArmTemplateParameterProperties]"}, - } - - def __init__( - self, - *, - arm_template_id: Optional[str] = None, - parameters: Optional[List["_models.ArmTemplateParameterProperties"]] = None, - **kwargs - ): - """ - :keyword arm_template_id: The Azure Resource Manager template's identifier. - :paramtype arm_template_id: str - :keyword parameters: The parameters of the Azure Resource Manager template. - :paramtype parameters: list[~azure.mgmt.devtestlabs.models.ArmTemplateParameterProperties] - """ - super().__init__(**kwargs) - self.arm_template_id = arm_template_id - self.parameters = parameters - - class EvaluatePoliciesProperties(_serialization.Model): """Properties for evaluating a policy set. @@ -1910,8 +2422,8 @@ def __init__( fact_data: Optional[str] = None, value_offset: Optional[str] = None, user_object_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword fact_name: The fact name. :paramtype fact_name: str @@ -1940,7 +2452,7 @@ class EvaluatePoliciesRequest(_serialization.Model): "policies": {"key": "policies", "type": "[EvaluatePoliciesProperties]"}, } - def __init__(self, *, policies: Optional[List["_models.EvaluatePoliciesProperties"]] = None, **kwargs): + def __init__(self, *, policies: Optional[List["_models.EvaluatePoliciesProperties"]] = None, **kwargs: Any) -> None: """ :keyword policies: Policies to evaluate. :paramtype policies: list[~azure.mgmt.devtestlabs.models.EvaluatePoliciesProperties] @@ -1960,7 +2472,7 @@ class EvaluatePoliciesResponse(_serialization.Model): "results": {"key": "results", "type": "[PolicySetResult]"}, } - def __init__(self, *, results: Optional[List["_models.PolicySetResult"]] = None, **kwargs): + def __init__(self, *, results: Optional[List["_models.PolicySetResult"]] = None, **kwargs: Any) -> None: """ :keyword results: Results of evaluating a policy set. :paramtype results: list[~azure.mgmt.devtestlabs.models.PolicySetResult] @@ -1972,8 +2484,8 @@ def __init__(self, *, results: Optional[List["_models.PolicySetResult"]] = None, class Event(_serialization.Model): """An event to be notified for. - :ivar event_name: The event type for which this notification is enabled (i.e. AutoShutdown, - Cost). Known values are: "AutoShutdown" and "Cost". + :ivar event_name: The event type for which this notification is enabled (i.e. AutoShutdown). + "AutoShutdown" :vartype event_name: str or ~azure.mgmt.devtestlabs.models.NotificationChannelEventType """ @@ -1981,10 +2493,12 @@ class Event(_serialization.Model): "event_name": {"key": "eventName", "type": "str"}, } - def __init__(self, *, event_name: Optional[Union[str, "_models.NotificationChannelEventType"]] = None, **kwargs): + def __init__( + self, *, event_name: Optional[Union[str, "_models.NotificationChannelEventType"]] = None, **kwargs: Any + ) -> None: """ - :keyword event_name: The event type for which this notification is enabled (i.e. AutoShutdown, - Cost). Known values are: "AutoShutdown" and "Cost". + :keyword event_name: The event type for which this notification is enabled (i.e. AutoShutdown). + "AutoShutdown" :paramtype event_name: str or ~azure.mgmt.devtestlabs.models.NotificationChannelEventType """ super().__init__(**kwargs) @@ -2012,8 +2526,8 @@ def __init__( *, blob_storage_absolute_sas_uri: Optional[str] = None, usage_start_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword blob_storage_absolute_sas_uri: The blob storage absolute sas uri with write permission to the container which the usage data needs to be uploaded to. @@ -2042,8 +2556,12 @@ class ExternalSubnet(_serialization.Model): } def __init__( - self, *, id: Optional[str] = None, name: Optional[str] = None, **kwargs # pylint: disable=redefined-builtin - ): + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword id: Gets or sets the identifier. :paramtype id: str @@ -2060,121 +2578,1577 @@ class Formula(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar description: The description of the formula. :vartype description: str :ivar author: The author of the formula. :vartype author: str - :ivar os_type: The OS type of the formula. - :vartype os_type: str + :ivar os_type_properties_os_type: The OS type of the formula. + :vartype os_type_properties_os_type: str :ivar creation_date: The creation date of the formula. :vartype creation_date: ~datetime.datetime - :ivar formula_content: The content of the formula. - :vartype formula_content: ~azure.mgmt.devtestlabs.models.LabVirtualMachineCreationParameter - :ivar vm: Information about a VM from which a formula is to be created. - :vartype vm: ~azure.mgmt.devtestlabs.models.FormulaPropertiesFromVm - :ivar provisioning_state: The provisioning status of the resource. - :vartype provisioning_state: str - :ivar unique_identifier: The unique immutable identifier of a resource (Guid). - :vartype unique_identifier: str + :ivar provisioning_state_properties_provisioning_state: The provisioning status of the + resource. + :vartype provisioning_state_properties_provisioning_state: str + :ivar unique_identifier_properties_unique_identifier: The unique immutable identifier of a + resource (Guid). + :vartype unique_identifier_properties_unique_identifier: str + :ivar lab_vm_id: The identifier of the VM from which a formula is to be created. + :vartype lab_vm_id: str + :ivar name_properties_formula_content_name: The name of the virtual machine or environment. + :vartype name_properties_formula_content_name: str + :ivar location_properties_formula_content_location: The location of the new virtual machine or + environment. + :vartype location_properties_formula_content_location: str + :ivar tags_properties_formula_content_tags: The tags of the resource. + :vartype tags_properties_formula_content_tags: dict[str, str] + :ivar notes: The notes of the virtual machine. + :vartype notes: str + :ivar owner_object_id: The object identifier of the owner of the virtual machine. + :vartype owner_object_id: str + :ivar owner_user_principal_name: The user principal name of the virtual machine owner. + :vartype owner_user_principal_name: str + :ivar created_by_user_id: The object identifier of the creator of the virtual machine. + :vartype created_by_user_id: str + :ivar created_by_user: The email address of creator of the virtual machine. + :vartype created_by_user: str + :ivar created_date_properties_formula_content_properties_created_date: The creation date of the + virtual machine. + :vartype created_date_properties_formula_content_properties_created_date: ~datetime.datetime + :ivar compute_id: The resource identifier (Microsoft.Compute) of the virtual machine. + :vartype compute_id: str + :ivar custom_image_id: The custom image identifier of the virtual machine. + :vartype custom_image_id: str + :ivar gallery_image_version_id: The shared gallery image version resource identifier of the + virtual machine. + :vartype gallery_image_version_id: str + :ivar shared_image_id: The shared image resource identifier of the virtual machine. + :vartype shared_image_id: str + :ivar shared_image_version: The shared image version for the specified shared image Id. Will + use latest if not specified. + :vartype shared_image_version: str + :ivar os_type_properties_formula_content_properties_os_type: The OS type of the virtual + machine. + :vartype os_type_properties_formula_content_properties_os_type: str + :ivar size: The size of the virtual machine. + :vartype size: str + :ivar user_name: The user name of the virtual machine. + :vartype user_name: str + :ivar password: The password of the virtual machine administrator. + :vartype password: str + :ivar ssh_key: The SSH key of the virtual machine administrator. + :vartype ssh_key: str + :ivar is_authentication_with_ssh_key: Indicates whether this virtual machine uses an SSH key + for authentication. + :vartype is_authentication_with_ssh_key: bool + :ivar fqdn: The fully-qualified domain name of the virtual machine. + :vartype fqdn: str + :ivar lab_subnet_name: The lab subnet name of the virtual machine. + :vartype lab_subnet_name: str + :ivar lab_virtual_network_id: The lab virtual network identifier of the virtual machine. + :vartype lab_virtual_network_id: str + :ivar disallow_public_ip_address: Indicates whether the virtual machine is to be created + without a public IP address. + :vartype disallow_public_ip_address: bool + :ivar artifacts: The artifacts to be installed on the virtual machine. + :vartype artifacts: list[~azure.mgmt.devtestlabs.models.ArtifactInstallProperties] + :ivar plan_id: The id of the plan associated with the virtual machine image. + :vartype plan_id: str + :ivar os_disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can + be used to overwrite the size of the disk in a virtual machine image. + :vartype os_disk_size_gb: int + :ivar expiration_date: The expiration date for VM. + :vartype expiration_date: ~datetime.datetime + :ivar allow_claim: Indicates whether another user can take ownership of the virtual machine. + :vartype allow_claim: bool + :ivar storage_type: Storage type to use for virtual machine (i.e. Standard, Premium, + StandardSSD). Known values are: "Standard", "Premium", and "StandardSSD". + :vartype storage_type: str or ~azure.mgmt.devtestlabs.models.StorageType + :ivar virtual_machine_creation_source: Tells source of creation of lab virtual machine. Output + property only. Known values are: "FromCustomImage", "FromGalleryImage", and + "FromSharedGalleryImage". + :vartype virtual_machine_creation_source: str or + ~azure.mgmt.devtestlabs.models.VirtualMachineCreationSource + :ivar environment_id: The resource ID of the environment that contains this virtual machine, if + any. + :vartype environment_id: str + :ivar data_disk_parameters: New or existing data disks to attach to the virtual machine after + creation. + :vartype data_disk_parameters: list[~azure.mgmt.devtestlabs.models.DataDiskProperties] + :ivar schedule_parameters: Virtual Machine schedules to be created. + :vartype schedule_parameters: list[~azure.mgmt.devtestlabs.models.ScheduleCreationParameter] + :ivar last_known_power_state: Last known compute power state captured in DTL. + :vartype last_known_power_state: str + :ivar can_apply_artifacts: Flag to determine if apply artifacts can be triggered at the time of + fetching the document. + :vartype can_apply_artifacts: bool + :ivar provisioning_state_properties_formula_content_properties_provisioning_state: The + provisioning status of the resource. + :vartype provisioning_state_properties_formula_content_properties_provisioning_state: str + :ivar unique_identifier_properties_formula_content_properties_unique_identifier: The unique + immutable identifier of a resource (Guid). + :vartype unique_identifier_properties_formula_content_properties_unique_identifier: str + :ivar security_profile: Option to apply more security protection for VMs. + :vartype security_profile: ~azure.mgmt.devtestlabs.models.SecurityProfile + :ivar id_properties_formula_content_properties_applicable_schedule_id: Fully qualified resource + ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_formula_content_properties_applicable_schedule_id: str + :ivar name_properties_formula_content_properties_applicable_schedule_name: The name of the + resource. + :vartype name_properties_formula_content_properties_applicable_schedule_name: str + :ivar type_properties_formula_content_properties_applicable_schedule_type: The type of the + resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_formula_content_properties_applicable_schedule_type: str + :ivar tags_properties_formula_content_properties_applicable_schedule_tags: Resource tags. + :vartype tags_properties_formula_content_properties_applicable_schedule_tags: dict[str, str] + :ivar location_properties_formula_content_properties_applicable_schedule_location: The + geo-location where the resource lives. + :vartype location_properties_formula_content_properties_applicable_schedule_location: str + :ivar system_data_properties_formula_content_properties_applicable_schedule_system_data: The + system metadata relating to this resource. + :vartype system_data_properties_formula_content_properties_applicable_schedule_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar + id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_id: + Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype + id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_id: str + :ivar + name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_name: + The name of the resource. + :vartype + name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_name: + str + :ivar + type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_type: + The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype + type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_type: + str + :ivar + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_tags: + Resource tags. + :vartype + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_tags: + dict[str, str] + :ivar + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_location: + The geo-location where the resource lives. + :vartype + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_location: + str + :ivar + system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_system_data: + The system metadata relating to this resource. + :vartype + system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :vartype + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: + The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: + str + :ivar + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :vartype + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + str + :ivar + created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date: + The creation date of the schedule. + :vartype + created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date: + ~datetime.datetime + :ivar + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + The resource ID to which the schedule belongs. + :vartype + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + str + :ivar + provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state: + The provisioning status of the resource. + :vartype + provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state: + str + :ivar + unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier: + The unique immutable identifier of a resource (Guid). + :vartype + unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier: + str + :ivar + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :ivar + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :vartype + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :ivar + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :vartype + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + int + :ivar + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + The time of day the schedule will occur. + :vartype + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + str + :ivar + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + list[str] + :ivar + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :vartype + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + str + :ivar + id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_id: + Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype + id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_id: + str + :ivar + name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_name: + The name of the resource. + :vartype + name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_name: + str + :ivar + type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_type: + The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype + type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_type: + str + :ivar + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_tags: + Resource tags. + :vartype + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_tags: + dict[str, str] + :ivar + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_location: + The geo-location where the resource lives. + :vartype + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_location: + str + :ivar + system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_system_data: + The system metadata relating to this resource. + :vartype + system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :vartype + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: + The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: + str + :ivar + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :vartype + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + str + :ivar + created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date: + The creation date of the schedule. + :vartype + created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date: + ~datetime.datetime + :ivar + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + The resource ID to which the schedule belongs. + :vartype + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + str + :ivar + provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state: + The provisioning status of the resource. + :vartype + provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state: + str + :ivar + unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier: + The unique immutable identifier of a resource (Guid). + :vartype + unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier: + str + :ivar + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :ivar + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :vartype + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :ivar + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :vartype + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + int + :ivar + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + The time of day the schedule will occur. + :vartype + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + str + :ivar + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :ivar + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :vartype + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + str + :ivar virtual_network_id: The resource ID of the virtual network. + :vartype virtual_network_id: str + :ivar subnet_id: The resource ID of the sub net. + :vartype subnet_id: str + :ivar public_ip_address_id: The resource ID of the public IP address. + :vartype public_ip_address_id: str + :ivar public_ip_address: The public IP address. + :vartype public_ip_address: str + :ivar private_ip_address: The private IP address. + :vartype private_ip_address: str + :ivar dns_name: The DNS name. + :vartype dns_name: str + :ivar rdp_authority: The RdpAuthority property is a server DNS host name or IP address followed + by the service port number for RDP (Remote Desktop Protocol). + :vartype rdp_authority: str + :ivar ssh_authority: The SshAuthority property is a server DNS host name or IP address followed + by the service port number for SSH. + :vartype ssh_authority: str + :ivar inbound_nat_rules: The incoming NAT rules. + :vartype inbound_nat_rules: list[~azure.mgmt.devtestlabs.models.InboundNatRule] + :ivar statuses: Gets the statuses of the virtual machine. + :vartype statuses: list[~azure.mgmt.devtestlabs.models.ComputeVmInstanceViewStatus] + :ivar os_type_properties_formula_content_properties_compute_vm_os_type: Gets the OS type of the + virtual machine. + :vartype os_type_properties_formula_content_properties_compute_vm_os_type: str + :ivar vm_size: Gets the size of the virtual machine. + :vartype vm_size: str + :ivar network_interface_id: Gets the network interface ID of the virtual machine. + :vartype network_interface_id: str + :ivar os_disk_id: Gets OS disk blob uri for the virtual machine. + :vartype os_disk_id: str + :ivar data_disk_ids: Gets data disks blob uri for the virtual machine. + :vartype data_disk_ids: list[str] + :ivar data_disks: Gets all data disks attached to the virtual machine. + :vartype data_disks: list[~azure.mgmt.devtestlabs.models.ComputeDataDisk] + :ivar offer: The offer of the gallery image. + :vartype offer: str + :ivar publisher: The publisher of the gallery image. + :vartype publisher: str + :ivar sku: The SKU of the gallery image. + :vartype sku: str + :ivar os_type_properties_formula_content_properties_gallery_image_reference_os_type: The OS + type of the gallery image. + :vartype os_type_properties_formula_content_properties_gallery_image_reference_os_type: str + :ivar version: The version of the gallery image. + :vartype version: str + :ivar deployment_status: The deployment status of the artifact. + :vartype deployment_status: str + :ivar artifacts_applied: The total count of the artifacts that were successfully applied. + :vartype artifacts_applied: int + :ivar total_artifacts: The total count of the artifacts that were tentatively applied. + :vartype total_artifacts: int + :ivar instance_count: The number of virtual machine instances to create. + :vartype instance_count: int """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "author": {"readonly": True}, "creation_date": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "unique_identifier": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "author": {"key": "properties.author", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, + "provisioning_state_properties_provisioning_state": {"readonly": True}, + "unique_identifier_properties_unique_identifier": {"readonly": True}, + "created_by_user_id": {"readonly": True}, + "created_by_user": {"readonly": True}, + "compute_id": {"readonly": True}, + "os_type_properties_formula_content_properties_os_type": {"readonly": True}, + "fqdn": {"readonly": True}, + "virtual_machine_creation_source": {"readonly": True}, + "last_known_power_state": {"readonly": True}, + "can_apply_artifacts": {"readonly": True}, + "provisioning_state_properties_formula_content_properties_provisioning_state": {"readonly": True}, + "unique_identifier_properties_formula_content_properties_unique_identifier": {"readonly": True}, + "id_properties_formula_content_properties_applicable_schedule_id": {"readonly": True}, + "name_properties_formula_content_properties_applicable_schedule_name": {"readonly": True}, + "type_properties_formula_content_properties_applicable_schedule_type": {"readonly": True}, + "system_data_properties_formula_content_properties_applicable_schedule_system_data": {"readonly": True}, + "id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_id": { + "readonly": True + }, + "name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_name": { + "readonly": True + }, + "type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_type": { + "readonly": True + }, + "system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_system_data": { + "readonly": True + }, + "created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date": { + "readonly": True + }, + "provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state": { + "readonly": True + }, + "unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier": { + "readonly": True + }, + "id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_id": { + "readonly": True + }, + "name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_name": { + "readonly": True + }, + "type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_type": { + "readonly": True + }, + "system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_system_data": { + "readonly": True + }, + "created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date": { + "readonly": True + }, + "provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state": { + "readonly": True + }, + "unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier": { + "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"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "author": {"key": "properties.author", "type": "str"}, + "os_type_properties_os_type": {"key": "properties.osType", "type": "str"}, "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, - "formula_content": {"key": "properties.formulaContent", "type": "LabVirtualMachineCreationParameter"}, - "vm": {"key": "properties.vm", "type": "FormulaPropertiesFromVm"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "provisioning_state_properties_provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier_properties_unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "lab_vm_id": {"key": "properties.vm.labVmId", "type": "str"}, + "name_properties_formula_content_name": {"key": "properties.formulaContent.name", "type": "str"}, + "location_properties_formula_content_location": {"key": "properties.formulaContent.location", "type": "str"}, + "tags_properties_formula_content_tags": {"key": "properties.formulaContent.tags", "type": "{str}"}, + "notes": {"key": "properties.formulaContent.properties.notes", "type": "str"}, + "owner_object_id": {"key": "properties.formulaContent.properties.ownerObjectId", "type": "str"}, + "owner_user_principal_name": { + "key": "properties.formulaContent.properties.ownerUserPrincipalName", + "type": "str", + }, + "created_by_user_id": {"key": "properties.formulaContent.properties.createdByUserId", "type": "str"}, + "created_by_user": {"key": "properties.formulaContent.properties.createdByUser", "type": "str"}, + "created_date_properties_formula_content_properties_created_date": { + "key": "properties.formulaContent.properties.createdDate", + "type": "iso-8601", + }, + "compute_id": {"key": "properties.formulaContent.properties.computeId", "type": "str"}, + "custom_image_id": {"key": "properties.formulaContent.properties.customImageId", "type": "str"}, + "gallery_image_version_id": { + "key": "properties.formulaContent.properties.galleryImageVersionId", + "type": "str", + }, + "shared_image_id": {"key": "properties.formulaContent.properties.sharedImageId", "type": "str"}, + "shared_image_version": {"key": "properties.formulaContent.properties.sharedImageVersion", "type": "str"}, + "os_type_properties_formula_content_properties_os_type": { + "key": "properties.formulaContent.properties.osType", + "type": "str", + }, + "size": {"key": "properties.formulaContent.properties.size", "type": "str"}, + "user_name": {"key": "properties.formulaContent.properties.userName", "type": "str"}, + "password": {"key": "properties.formulaContent.properties.password", "type": "str"}, + "ssh_key": {"key": "properties.formulaContent.properties.sshKey", "type": "str"}, + "is_authentication_with_ssh_key": { + "key": "properties.formulaContent.properties.isAuthenticationWithSshKey", + "type": "bool", + }, + "fqdn": {"key": "properties.formulaContent.properties.fqdn", "type": "str"}, + "lab_subnet_name": {"key": "properties.formulaContent.properties.labSubnetName", "type": "str"}, + "lab_virtual_network_id": {"key": "properties.formulaContent.properties.labVirtualNetworkId", "type": "str"}, + "disallow_public_ip_address": { + "key": "properties.formulaContent.properties.disallowPublicIpAddress", + "type": "bool", + }, + "artifacts": {"key": "properties.formulaContent.properties.artifacts", "type": "[ArtifactInstallProperties]"}, + "plan_id": {"key": "properties.formulaContent.properties.planId", "type": "str"}, + "os_disk_size_gb": {"key": "properties.formulaContent.properties.osDiskSizeGb", "type": "int"}, + "expiration_date": {"key": "properties.formulaContent.properties.expirationDate", "type": "iso-8601"}, + "allow_claim": {"key": "properties.formulaContent.properties.allowClaim", "type": "bool"}, + "storage_type": {"key": "properties.formulaContent.properties.storageType", "type": "str"}, + "virtual_machine_creation_source": { + "key": "properties.formulaContent.properties.virtualMachineCreationSource", + "type": "str", + }, + "environment_id": {"key": "properties.formulaContent.properties.environmentId", "type": "str"}, + "data_disk_parameters": { + "key": "properties.formulaContent.properties.dataDiskParameters", + "type": "[DataDiskProperties]", + }, + "schedule_parameters": { + "key": "properties.formulaContent.properties.scheduleParameters", + "type": "[ScheduleCreationParameter]", + }, + "last_known_power_state": {"key": "properties.formulaContent.properties.lastKnownPowerState", "type": "str"}, + "can_apply_artifacts": {"key": "properties.formulaContent.properties.canApplyArtifacts", "type": "bool"}, + "provisioning_state_properties_formula_content_properties_provisioning_state": { + "key": "properties.formulaContent.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_formula_content_properties_unique_identifier": { + "key": "properties.formulaContent.properties.uniqueIdentifier", + "type": "str", + }, + "security_profile": {"key": "properties.formulaContent.properties.securityProfile", "type": "SecurityProfile"}, + "id_properties_formula_content_properties_applicable_schedule_id": { + "key": "properties.formulaContent.properties.applicableSchedule.id", + "type": "str", + }, + "name_properties_formula_content_properties_applicable_schedule_name": { + "key": "properties.formulaContent.properties.applicableSchedule.name", + "type": "str", + }, + "type_properties_formula_content_properties_applicable_schedule_type": { + "key": "properties.formulaContent.properties.applicableSchedule.type", + "type": "str", + }, + "tags_properties_formula_content_properties_applicable_schedule_tags": { + "key": "properties.formulaContent.properties.applicableSchedule.tags", + "type": "{str}", + }, + "location_properties_formula_content_properties_applicable_schedule_location": { + "key": "properties.formulaContent.properties.applicableSchedule.location", + "type": "str", + }, + "system_data_properties_formula_content_properties_applicable_schedule_system_data": { + "key": "properties.formulaContent.properties.applicableSchedule.systemData", + "type": "SystemData", + }, + "id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_id": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.id", + "type": "str", + }, + "name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_name": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.name", + "type": "str", + }, + "type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_type": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.type", + "type": "str", + }, + "tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_tags": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.tags", + "type": "{str}", + }, + "location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_location": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.location", + "type": "str", + }, + "system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_system_data": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.systemData", + "type": "SystemData", + }, + "status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_status": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.status", + "type": "str", + }, + "task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsStartup.properties.weeklyRecurrence.time", + "type": "str", + }, + "id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_id": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.id", + "type": "str", + }, + "name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_name": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.name", + "type": "str", + }, + "type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_type": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.type", + "type": "str", + }, + "tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_tags": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.tags", + "type": "{str}", + }, + "location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_location": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.location", + "type": "str", + }, + "system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_system_data": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.systemData", + "type": "SystemData", + }, + "status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.status", + "type": "str", + }, + "task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time": { + "key": "properties.formulaContent.properties.applicableSchedule.properties.labVmsShutdown.properties.weeklyRecurrence.time", + "type": "str", + }, + "virtual_network_id": { + "key": "properties.formulaContent.properties.networkInterface.virtualNetworkId", + "type": "str", + }, + "subnet_id": {"key": "properties.formulaContent.properties.networkInterface.subnetId", "type": "str"}, + "public_ip_address_id": { + "key": "properties.formulaContent.properties.networkInterface.publicIpAddressId", + "type": "str", + }, + "public_ip_address": { + "key": "properties.formulaContent.properties.networkInterface.publicIpAddress", + "type": "str", + }, + "private_ip_address": { + "key": "properties.formulaContent.properties.networkInterface.privateIpAddress", + "type": "str", + }, + "dns_name": {"key": "properties.formulaContent.properties.networkInterface.dnsName", "type": "str"}, + "rdp_authority": {"key": "properties.formulaContent.properties.networkInterface.rdpAuthority", "type": "str"}, + "ssh_authority": {"key": "properties.formulaContent.properties.networkInterface.sshAuthority", "type": "str"}, + "inbound_nat_rules": { + "key": "properties.formulaContent.properties.networkInterface.sharedPublicIpAddressConfiguration.inboundNatRules", + "type": "[InboundNatRule]", + }, + "statuses": { + "key": "properties.formulaContent.properties.computeVm.statuses", + "type": "[ComputeVmInstanceViewStatus]", + }, + "os_type_properties_formula_content_properties_compute_vm_os_type": { + "key": "properties.formulaContent.properties.computeVm.osType", + "type": "str", + }, + "vm_size": {"key": "properties.formulaContent.properties.computeVm.vmSize", "type": "str"}, + "network_interface_id": { + "key": "properties.formulaContent.properties.computeVm.networkInterfaceId", + "type": "str", + }, + "os_disk_id": {"key": "properties.formulaContent.properties.computeVm.osDiskId", "type": "str"}, + "data_disk_ids": {"key": "properties.formulaContent.properties.computeVm.dataDiskIds", "type": "[str]"}, + "data_disks": {"key": "properties.formulaContent.properties.computeVm.dataDisks", "type": "[ComputeDataDisk]"}, + "offer": {"key": "properties.formulaContent.properties.galleryImageReference.offer", "type": "str"}, + "publisher": {"key": "properties.formulaContent.properties.galleryImageReference.publisher", "type": "str"}, + "sku": {"key": "properties.formulaContent.properties.galleryImageReference.sku", "type": "str"}, + "os_type_properties_formula_content_properties_gallery_image_reference_os_type": { + "key": "properties.formulaContent.properties.galleryImageReference.osType", + "type": "str", + }, + "version": {"key": "properties.formulaContent.properties.galleryImageReference.version", "type": "str"}, + "deployment_status": { + "key": "properties.formulaContent.properties.artifactDeploymentStatus.deploymentStatus", + "type": "str", + }, + "artifacts_applied": { + "key": "properties.formulaContent.properties.artifactDeploymentStatus.artifactsApplied", + "type": "int", + }, + "total_artifacts": { + "key": "properties.formulaContent.properties.artifactDeploymentStatus.totalArtifacts", + "type": "int", + }, + "instance_count": { + "key": "properties.formulaContent.properties.bulkCreationParameters.instanceCount", + "type": "int", + }, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, - os_type: Optional[str] = None, - formula_content: Optional["_models.LabVirtualMachineCreationParameter"] = None, - vm: Optional["_models.FormulaPropertiesFromVm"] = None, - **kwargs - ): + os_type_properties_os_type: Optional[str] = None, + lab_vm_id: Optional[str] = None, + name_properties_formula_content_name: Optional[str] = None, + location_properties_formula_content_location: Optional[str] = None, + tags_properties_formula_content_tags: Optional[Dict[str, str]] = None, + notes: Optional[str] = None, + owner_object_id: str = "dynamicValue", + owner_user_principal_name: Optional[str] = None, + created_date_properties_formula_content_properties_created_date: Optional[datetime.datetime] = None, + custom_image_id: Optional[str] = None, + gallery_image_version_id: Optional[str] = None, + shared_image_id: Optional[str] = None, + shared_image_version: Optional[str] = None, + size: Optional[str] = None, + user_name: Optional[str] = None, + password: Optional[str] = None, + ssh_key: Optional[str] = None, + is_authentication_with_ssh_key: Optional[bool] = None, + lab_subnet_name: Optional[str] = None, + lab_virtual_network_id: Optional[str] = None, + disallow_public_ip_address: bool = False, + artifacts: Optional[List["_models.ArtifactInstallProperties"]] = None, + plan_id: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + expiration_date: Optional[datetime.datetime] = None, + allow_claim: bool = False, + storage_type: Optional[Union[str, "_models.StorageType"]] = None, + environment_id: Optional[str] = None, + data_disk_parameters: Optional[List["_models.DataDiskProperties"]] = None, + schedule_parameters: Optional[List["_models.ScheduleCreationParameter"]] = None, + security_profile: Optional["_models.SecurityProfile"] = None, + tags_properties_formula_content_properties_applicable_schedule_tags: Optional[Dict[str, str]] = None, + location_properties_formula_content_properties_applicable_schedule_location: Optional[str] = None, + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_tags: Optional[ + Dict[str, str] + ] = None, + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_location: Optional[ + str + ] = None, + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: Optional[ + str + ] = None, + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: Optional[ + str + ] = None, + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: Optional[ + str + ] = None, + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: Optional[ + str + ] = None, + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: Optional[ + int + ] = None, + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: Optional[ + str + ] = None, + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: Optional[ + List[str] + ] = None, + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: Optional[ + str + ] = None, + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Optional[ + Dict[str, str] + ] = None, + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_location: Optional[ + str + ] = None, + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: Optional[ + str + ] = None, + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: Optional[ + str + ] = None, + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: Optional[ + str + ] = None, + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: Optional[ + str + ] = None, + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: Optional[ + int + ] = None, + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: Optional[ + str + ] = None, + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: Optional[ + List[str] + ] = None, + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: Optional[ + str + ] = None, + virtual_network_id: Optional[str] = None, + subnet_id: Optional[str] = None, + public_ip_address_id: Optional[str] = None, + public_ip_address: Optional[str] = None, + private_ip_address: Optional[str] = None, + dns_name: Optional[str] = None, + rdp_authority: Optional[str] = None, + ssh_authority: Optional[str] = None, + inbound_nat_rules: Optional[List["_models.InboundNatRule"]] = None, + statuses: Optional[List["_models.ComputeVmInstanceViewStatus"]] = None, + os_type_properties_formula_content_properties_compute_vm_os_type: Optional[str] = None, + vm_size: Optional[str] = None, + network_interface_id: Optional[str] = None, + os_disk_id: Optional[str] = None, + data_disk_ids: Optional[List[str]] = None, + data_disks: Optional[List["_models.ComputeDataDisk"]] = None, + offer: Optional[str] = None, + publisher: Optional[str] = None, + sku: Optional[str] = None, + os_type_properties_formula_content_properties_gallery_image_reference_os_type: Optional[str] = None, + version: Optional[str] = None, + deployment_status: Optional[str] = None, + artifacts_applied: Optional[int] = None, + total_artifacts: Optional[int] = None, + instance_count: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword description: The description of the formula. :paramtype description: str - :keyword os_type: The OS type of the formula. - :paramtype os_type: str - :keyword formula_content: The content of the formula. - :paramtype formula_content: ~azure.mgmt.devtestlabs.models.LabVirtualMachineCreationParameter - :keyword vm: Information about a VM from which a formula is to be created. - :paramtype vm: ~azure.mgmt.devtestlabs.models.FormulaPropertiesFromVm + :keyword os_type_properties_os_type: The OS type of the formula. + :paramtype os_type_properties_os_type: str + :keyword lab_vm_id: The identifier of the VM from which a formula is to be created. + :paramtype lab_vm_id: str + :keyword name_properties_formula_content_name: The name of the virtual machine or environment. + :paramtype name_properties_formula_content_name: str + :keyword location_properties_formula_content_location: The location of the new virtual machine + or environment. + :paramtype location_properties_formula_content_location: str + :keyword tags_properties_formula_content_tags: The tags of the resource. + :paramtype tags_properties_formula_content_tags: dict[str, str] + :keyword notes: The notes of the virtual machine. + :paramtype notes: str + :keyword owner_object_id: The object identifier of the owner of the virtual machine. + :paramtype owner_object_id: str + :keyword owner_user_principal_name: The user principal name of the virtual machine owner. + :paramtype owner_user_principal_name: str + :keyword created_date_properties_formula_content_properties_created_date: The creation date of + the virtual machine. + :paramtype created_date_properties_formula_content_properties_created_date: ~datetime.datetime + :keyword custom_image_id: The custom image identifier of the virtual machine. + :paramtype custom_image_id: str + :keyword gallery_image_version_id: The shared gallery image version resource identifier of the + virtual machine. + :paramtype gallery_image_version_id: str + :keyword shared_image_id: The shared image resource identifier of the virtual machine. + :paramtype shared_image_id: str + :keyword shared_image_version: The shared image version for the specified shared image Id. Will + use latest if not specified. + :paramtype shared_image_version: str + :keyword size: The size of the virtual machine. + :paramtype size: str + :keyword user_name: The user name of the virtual machine. + :paramtype user_name: str + :keyword password: The password of the virtual machine administrator. + :paramtype password: str + :keyword ssh_key: The SSH key of the virtual machine administrator. + :paramtype ssh_key: str + :keyword is_authentication_with_ssh_key: Indicates whether this virtual machine uses an SSH key + for authentication. + :paramtype is_authentication_with_ssh_key: bool + :keyword lab_subnet_name: The lab subnet name of the virtual machine. + :paramtype lab_subnet_name: str + :keyword lab_virtual_network_id: The lab virtual network identifier of the virtual machine. + :paramtype lab_virtual_network_id: str + :keyword disallow_public_ip_address: Indicates whether the virtual machine is to be created + without a public IP address. + :paramtype disallow_public_ip_address: bool + :keyword artifacts: The artifacts to be installed on the virtual machine. + :paramtype artifacts: list[~azure.mgmt.devtestlabs.models.ArtifactInstallProperties] + :keyword plan_id: The id of the plan associated with the virtual machine image. + :paramtype plan_id: str + :keyword os_disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element + can be used to overwrite the size of the disk in a virtual machine image. + :paramtype os_disk_size_gb: int + :keyword expiration_date: The expiration date for VM. + :paramtype expiration_date: ~datetime.datetime + :keyword allow_claim: Indicates whether another user can take ownership of the virtual machine. + :paramtype allow_claim: bool + :keyword storage_type: Storage type to use for virtual machine (i.e. Standard, Premium, + StandardSSD). Known values are: "Standard", "Premium", and "StandardSSD". + :paramtype storage_type: str or ~azure.mgmt.devtestlabs.models.StorageType + :keyword environment_id: The resource ID of the environment that contains this virtual machine, + if any. + :paramtype environment_id: str + :keyword data_disk_parameters: New or existing data disks to attach to the virtual machine + after creation. + :paramtype data_disk_parameters: list[~azure.mgmt.devtestlabs.models.DataDiskProperties] + :keyword schedule_parameters: Virtual Machine schedules to be created. + :paramtype schedule_parameters: list[~azure.mgmt.devtestlabs.models.ScheduleCreationParameter] + :keyword security_profile: Option to apply more security protection for VMs. + :paramtype security_profile: ~azure.mgmt.devtestlabs.models.SecurityProfile + :keyword tags_properties_formula_content_properties_applicable_schedule_tags: Resource tags. + :paramtype tags_properties_formula_content_properties_applicable_schedule_tags: dict[str, str] + :keyword location_properties_formula_content_properties_applicable_schedule_location: The + geo-location where the resource lives. + :paramtype location_properties_formula_content_properties_applicable_schedule_location: str + :keyword + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_tags: + Resource tags. + :paramtype + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_tags: + dict[str, str] + :keyword + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_location: + The geo-location where the resource lives. + :paramtype + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_location: + str + :keyword + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :paramtype + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: + The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: + str + :keyword + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :paramtype + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + str + :keyword + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + The resource ID to which the schedule belongs. + :paramtype + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + str + :keyword + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :keyword + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :keyword + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :paramtype + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + int + :keyword + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + The time of day the schedule will occur. + :paramtype + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + str + :keyword + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + list[str] + :keyword + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :paramtype + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + str + :keyword + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_tags: + Resource tags. + :paramtype + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_tags: + dict[str, str] + :keyword + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_location: + The geo-location where the resource lives. + :paramtype + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_location: + str + :keyword + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :paramtype + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: + The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype + task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: + str + :keyword + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :paramtype + time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + str + :keyword + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + The resource ID to which the schedule belongs. + :paramtype + target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + str + :keyword + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype + status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :keyword + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :keyword + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :paramtype + minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + int + :keyword + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + The time of day the schedule will occur. + :paramtype + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + str + :keyword + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype + weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :keyword + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :paramtype + time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + str + :keyword virtual_network_id: The resource ID of the virtual network. + :paramtype virtual_network_id: str + :keyword subnet_id: The resource ID of the sub net. + :paramtype subnet_id: str + :keyword public_ip_address_id: The resource ID of the public IP address. + :paramtype public_ip_address_id: str + :keyword public_ip_address: The public IP address. + :paramtype public_ip_address: str + :keyword private_ip_address: The private IP address. + :paramtype private_ip_address: str + :keyword dns_name: The DNS name. + :paramtype dns_name: str + :keyword rdp_authority: The RdpAuthority property is a server DNS host name or IP address + followed by the service port number for RDP (Remote Desktop Protocol). + :paramtype rdp_authority: str + :keyword ssh_authority: The SshAuthority property is a server DNS host name or IP address + followed by the service port number for SSH. + :paramtype ssh_authority: str + :keyword inbound_nat_rules: The incoming NAT rules. + :paramtype inbound_nat_rules: list[~azure.mgmt.devtestlabs.models.InboundNatRule] + :keyword statuses: Gets the statuses of the virtual machine. + :paramtype statuses: list[~azure.mgmt.devtestlabs.models.ComputeVmInstanceViewStatus] + :keyword os_type_properties_formula_content_properties_compute_vm_os_type: Gets the OS type of + the virtual machine. + :paramtype os_type_properties_formula_content_properties_compute_vm_os_type: str + :keyword vm_size: Gets the size of the virtual machine. + :paramtype vm_size: str + :keyword network_interface_id: Gets the network interface ID of the virtual machine. + :paramtype network_interface_id: str + :keyword os_disk_id: Gets OS disk blob uri for the virtual machine. + :paramtype os_disk_id: str + :keyword data_disk_ids: Gets data disks blob uri for the virtual machine. + :paramtype data_disk_ids: list[str] + :keyword data_disks: Gets all data disks attached to the virtual machine. + :paramtype data_disks: list[~azure.mgmt.devtestlabs.models.ComputeDataDisk] + :keyword offer: The offer of the gallery image. + :paramtype offer: str + :keyword publisher: The publisher of the gallery image. + :paramtype publisher: str + :keyword sku: The SKU of the gallery image. + :paramtype sku: str + :keyword os_type_properties_formula_content_properties_gallery_image_reference_os_type: The OS + type of the gallery image. + :paramtype os_type_properties_formula_content_properties_gallery_image_reference_os_type: str + :keyword version: The version of the gallery image. + :paramtype version: str + :keyword deployment_status: The deployment status of the artifact. + :paramtype deployment_status: str + :keyword artifacts_applied: The total count of the artifacts that were successfully applied. + :paramtype artifacts_applied: int + :keyword total_artifacts: The total count of the artifacts that were tentatively applied. + :paramtype total_artifacts: int + :keyword instance_count: The number of virtual machine instances to create. + :paramtype instance_count: int """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.description = description self.author = None - self.os_type = os_type + self.os_type_properties_os_type = os_type_properties_os_type self.creation_date = None - self.formula_content = formula_content - self.vm = vm - self.provisioning_state = None - self.unique_identifier = None + self.provisioning_state_properties_provisioning_state = None + self.unique_identifier_properties_unique_identifier = None + self.lab_vm_id = lab_vm_id + self.name_properties_formula_content_name = name_properties_formula_content_name + self.location_properties_formula_content_location = location_properties_formula_content_location + self.tags_properties_formula_content_tags = tags_properties_formula_content_tags + self.notes = notes + self.owner_object_id = owner_object_id + self.owner_user_principal_name = owner_user_principal_name + self.created_by_user_id = None + self.created_by_user = None + self.created_date_properties_formula_content_properties_created_date = ( + created_date_properties_formula_content_properties_created_date + ) + self.compute_id = None + self.custom_image_id = custom_image_id + self.gallery_image_version_id = gallery_image_version_id + self.shared_image_id = shared_image_id + self.shared_image_version = shared_image_version + self.os_type_properties_formula_content_properties_os_type = None + self.size = size + self.user_name = user_name + self.password = password + self.ssh_key = ssh_key + self.is_authentication_with_ssh_key = is_authentication_with_ssh_key + self.fqdn = None + self.lab_subnet_name = lab_subnet_name + self.lab_virtual_network_id = lab_virtual_network_id + self.disallow_public_ip_address = disallow_public_ip_address + self.artifacts = artifacts + self.plan_id = plan_id + self.os_disk_size_gb = os_disk_size_gb + self.expiration_date = expiration_date + self.allow_claim = allow_claim + self.storage_type = storage_type + self.virtual_machine_creation_source = None + self.environment_id = environment_id + self.data_disk_parameters = data_disk_parameters + self.schedule_parameters = schedule_parameters + self.last_known_power_state = None + self.can_apply_artifacts = None + self.provisioning_state_properties_formula_content_properties_provisioning_state = None + self.unique_identifier_properties_formula_content_properties_unique_identifier = None + self.security_profile = security_profile + self.id_properties_formula_content_properties_applicable_schedule_id = None + self.name_properties_formula_content_properties_applicable_schedule_name = None + self.type_properties_formula_content_properties_applicable_schedule_type = None + self.tags_properties_formula_content_properties_applicable_schedule_tags = ( + tags_properties_formula_content_properties_applicable_schedule_tags + ) + self.location_properties_formula_content_properties_applicable_schedule_location = ( + location_properties_formula_content_properties_applicable_schedule_location + ) + self.system_data_properties_formula_content_properties_applicable_schedule_system_data = None + self.id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_id = None + self.name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_name = None + self.type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_type = None + self.tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_tags = ( + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_tags + ) + self.location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_location = ( + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_location + ) + self.system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_system_data = ( + None + ) + self.status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_status = status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_status + self.task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type = task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type + self.time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id = time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id + self.created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date = ( + None + ) + self.target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id = target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id + self.provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state = ( + None + ) + self.unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier = ( + None + ) + self.status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status = status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status + self.time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes = time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes + self.webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url = webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url + self.email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient = email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient + self.notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale = notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale + self.minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute = minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute + self.time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time = time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time + self.weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays = weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays + self.time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time = time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time + self.id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_id = None + self.name_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_name = None + self.type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_type = None + self.tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_tags = ( + tags_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_tags + ) + self.location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_location = ( + location_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_location + ) + self.system_data_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_system_data = ( + None + ) + self.status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status = status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status + self.task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type = task_type_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type + self.time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id = time_zone_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id + self.created_date_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date = ( + None + ) + self.target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id = target_resource_id_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id + self.provisioning_state_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state = ( + None + ) + self.unique_identifier_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier = ( + None + ) + self.status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status = status_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status + self.time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes = time_in_minutes_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes + self.webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url = webhook_url_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url + self.email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient = email_recipient_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient + self.notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale = notification_locale_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale + self.minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute = minute_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute + self.time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time = time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time + self.weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays = weekdays_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays + self.time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time = time_properties_formula_content_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time + self.virtual_network_id = virtual_network_id + self.subnet_id = subnet_id + self.public_ip_address_id = public_ip_address_id + self.public_ip_address = public_ip_address + self.private_ip_address = private_ip_address + self.dns_name = dns_name + self.rdp_authority = rdp_authority + self.ssh_authority = ssh_authority + self.inbound_nat_rules = inbound_nat_rules + self.statuses = statuses + self.os_type_properties_formula_content_properties_compute_vm_os_type = ( + os_type_properties_formula_content_properties_compute_vm_os_type + ) + self.vm_size = vm_size + self.network_interface_id = network_interface_id + self.os_disk_id = os_disk_id + self.data_disk_ids = data_disk_ids + self.data_disks = data_disks + self.offer = offer + self.publisher = publisher + self.sku = sku + self.os_type_properties_formula_content_properties_gallery_image_reference_os_type = ( + os_type_properties_formula_content_properties_gallery_image_reference_os_type + ) + self.version = version + self.deployment_status = deployment_status + self.artifacts_applied = artifacts_applied + self.total_artifacts = total_artifacts + self.instance_count = instance_count class FormulaFragment(UpdateResource): - """A formula for creating a VM, specifying an image base and other parameters. + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) class FormulaList(_serialization.Model): - """The response of a list operation. + """Contains a list of formulas and their properties. - :ivar value: Results of the list operation. + :ivar value: List of formulas and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.Formula] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -2183,11 +4157,13 @@ class FormulaList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Formula"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Formula"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of formulas and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.Formula] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -2195,49 +4171,33 @@ def __init__(self, *, value: Optional[List["_models.Formula"]] = None, next_link self.next_link = next_link -class FormulaPropertiesFromVm(_serialization.Model): - """Information about a VM from which a formula is to be created. - - :ivar lab_vm_id: The identifier of the VM from which a formula is to be created. - :vartype lab_vm_id: str - """ - - _attribute_map = { - "lab_vm_id": {"key": "labVmId", "type": "str"}, - } - - def __init__(self, *, lab_vm_id: Optional[str] = None, **kwargs): - """ - :keyword lab_vm_id: The identifier of the VM from which a formula is to be created. - :paramtype lab_vm_id: str - """ - super().__init__(**kwargs) - self.lab_vm_id = lab_vm_id - - class GalleryImage(Resource): # pylint: disable=too-many-instance-attributes """A gallery image. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar author: The author of the gallery image. :vartype author: str :ivar created_date: The creation date of the gallery image. :vartype created_date: ~datetime.datetime :ivar description: The description of the gallery image. :vartype description: str - :ivar image_reference: The image reference of the gallery image. - :vartype image_reference: ~azure.mgmt.devtestlabs.models.GalleryImageReference :ivar icon: The icon of the gallery image. :vartype icon: str :ivar enabled: Indicates whether this gallery image is enabled. @@ -2247,12 +4207,24 @@ class GalleryImage(Resource): # pylint: disable=too-many-instance-attributes :ivar is_plan_authorized: Indicates if the plan has been authorized for programmatic deployment. :vartype is_plan_authorized: bool + :ivar offer: The offer of the gallery image. + :vartype offer: str + :ivar publisher: The publisher of the gallery image. + :vartype publisher: str + :ivar sku: The SKU of the gallery image. + :vartype sku: str + :ivar os_type: The OS type of the gallery image. + :vartype os_type: str + :ivar version: The version of the gallery image. + :vartype version: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "created_date": {"readonly": True}, } @@ -2260,43 +4232,50 @@ class GalleryImage(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "author": {"key": "properties.author", "type": "str"}, "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, "description": {"key": "properties.description", "type": "str"}, - "image_reference": {"key": "properties.imageReference", "type": "GalleryImageReference"}, "icon": {"key": "properties.icon", "type": "str"}, "enabled": {"key": "properties.enabled", "type": "bool"}, "plan_id": {"key": "properties.planId", "type": "str"}, "is_plan_authorized": {"key": "properties.isPlanAuthorized", "type": "bool"}, + "offer": {"key": "properties.imageReference.offer", "type": "str"}, + "publisher": {"key": "properties.imageReference.publisher", "type": "str"}, + "sku": {"key": "properties.imageReference.sku", "type": "str"}, + "os_type": {"key": "properties.imageReference.osType", "type": "str"}, + "version": {"key": "properties.imageReference.version", "type": "str"}, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, author: Optional[str] = None, description: Optional[str] = None, - image_reference: Optional["_models.GalleryImageReference"] = None, icon: Optional[str] = None, enabled: Optional[bool] = None, plan_id: Optional[str] = None, is_plan_authorized: Optional[bool] = None, - **kwargs - ): + offer: Optional[str] = None, + publisher: Optional[str] = None, + sku: Optional[str] = None, + os_type: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword author: The author of the gallery image. :paramtype author: str :keyword description: The description of the gallery image. :paramtype description: str - :keyword image_reference: The image reference of the gallery image. - :paramtype image_reference: ~azure.mgmt.devtestlabs.models.GalleryImageReference :keyword icon: The icon of the gallery image. :paramtype icon: str :keyword enabled: Indicates whether this gallery image is enabled. @@ -2306,24 +4285,39 @@ def __init__( :keyword is_plan_authorized: Indicates if the plan has been authorized for programmatic deployment. :paramtype is_plan_authorized: bool + :keyword offer: The offer of the gallery image. + :paramtype offer: str + :keyword publisher: The publisher of the gallery image. + :paramtype publisher: str + :keyword sku: The SKU of the gallery image. + :paramtype sku: str + :keyword os_type: The OS type of the gallery image. + :paramtype os_type: str + :keyword version: The version of the gallery image. + :paramtype version: str """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.author = author self.created_date = None self.description = description - self.image_reference = image_reference self.icon = icon self.enabled = enabled self.plan_id = plan_id self.is_plan_authorized = is_plan_authorized + self.offer = offer + self.publisher = publisher + self.sku = sku + self.os_type = os_type + self.version = version class GalleryImageList(_serialization.Model): - """The response of a list operation. + """Contains a list of galleryImages and their properties. - :ivar value: Results of the list operation. + :ivar value: List of galleryImages and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.GalleryImage] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -2333,12 +4327,12 @@ class GalleryImageList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.GalleryImage"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.GalleryImage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of galleryImages and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.GalleryImage] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -2346,59 +4340,6 @@ def __init__( self.next_link = next_link -class GalleryImageReference(_serialization.Model): - """The reference information for an Azure Marketplace image. - - :ivar offer: The offer of the gallery image. - :vartype offer: str - :ivar publisher: The publisher of the gallery image. - :vartype publisher: str - :ivar sku: The SKU of the gallery image. - :vartype sku: str - :ivar os_type: The OS type of the gallery image. - :vartype os_type: str - :ivar version: The version of the gallery image. - :vartype version: str - """ - - _attribute_map = { - "offer": {"key": "offer", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - offer: Optional[str] = None, - publisher: Optional[str] = None, - sku: Optional[str] = None, - os_type: Optional[str] = None, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword offer: The offer of the gallery image. - :paramtype offer: str - :keyword publisher: The publisher of the gallery image. - :paramtype publisher: str - :keyword sku: The SKU of the gallery image. - :paramtype sku: str - :keyword os_type: The OS type of the gallery image. - :paramtype os_type: str - :keyword version: The version of the gallery image. - :paramtype version: str - """ - super().__init__(**kwargs) - self.offer = offer - self.publisher = publisher - self.sku = sku - self.os_type = os_type - self.version = version - - class GenerateArmTemplateRequest(_serialization.Model): """Parameters for generating an ARM template for deploying artifacts. @@ -2428,8 +4369,8 @@ def __init__( parameters: Optional[List["_models.ParameterInfo"]] = None, location: Optional[str] = None, file_upload_options: Optional[Union[str, "_models.FileUploadOptions"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword virtual_machine_name: The resource name of the virtual machine. :paramtype virtual_machine_name: str @@ -2460,7 +4401,7 @@ class GenerateUploadUriParameter(_serialization.Model): "blob_name": {"key": "blobName", "type": "str"}, } - def __init__(self, *, blob_name: Optional[str] = None, **kwargs): + def __init__(self, *, blob_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword blob_name: The blob name of the upload URI. :paramtype blob_name: str @@ -2480,7 +4421,7 @@ class GenerateUploadUriResponse(_serialization.Model): "upload_uri": {"key": "uploadUri", "type": "str"}, } - def __init__(self, *, upload_uri: Optional[str] = None, **kwargs): + def __init__(self, *, upload_uri: Optional[str] = None, **kwargs: Any) -> None: """ :keyword upload_uri: The upload URI for the VHD. :paramtype upload_uri: str @@ -2489,31 +4430,11 @@ def __init__(self, *, upload_uri: Optional[str] = None, **kwargs): self.upload_uri = upload_uri -class HourDetails(_serialization.Model): - """Properties of an hourly schedule. - - :ivar minute: Minutes of the hour the schedule will run. - :vartype minute: int - """ - - _attribute_map = { - "minute": {"key": "minute", "type": "int"}, - } - - def __init__(self, *, minute: Optional[int] = None, **kwargs): - """ - :keyword minute: Minutes of the hour the schedule will run. - :paramtype minute: int - """ - super().__init__(**kwargs) - self.minute = minute - - class IdentityProperties(_serialization.Model): """Properties of a managed identity. - :ivar type: Managed identity. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". + :ivar type: Type of identity (SystemAssigned, UserAssigned, None). Known values are: "None", + "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". :vartype type: str or ~azure.mgmt.devtestlabs.models.ManagedIdentityType :ivar principal_id: The principal id of resource identity. :vartype principal_id: str @@ -2521,6 +4442,8 @@ class IdentityProperties(_serialization.Model): :vartype tenant_id: str :ivar client_secret_url: The client secret URL of the identity. :vartype client_secret_url: str + :ivar user_assigned_identities: If Type is 'UserAssigned': List of user assigned identities. + :vartype user_assigned_identities: dict[str, JSON] """ _attribute_map = { @@ -2528,6 +4451,7 @@ class IdentityProperties(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, "tenant_id": {"key": "tenantId", "type": "str"}, "client_secret_url": {"key": "clientSecretUrl", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{object}"}, } def __init__( @@ -2537,11 +4461,12 @@ def __init__( principal_id: Optional[str] = None, tenant_id: Optional[str] = None, client_secret_url: Optional[str] = None, - **kwargs - ): + user_assigned_identities: Optional[Dict[str, JSON]] = None, + **kwargs: Any + ) -> None: """ - :keyword type: Managed identity. Known values are: "None", "SystemAssigned", "UserAssigned", - and "SystemAssigned,UserAssigned". + :keyword type: Type of identity (SystemAssigned, UserAssigned, None). Known values are: "None", + "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". :paramtype type: str or ~azure.mgmt.devtestlabs.models.ManagedIdentityType :keyword principal_id: The principal id of resource identity. :paramtype principal_id: str @@ -2549,16 +4474,40 @@ def __init__( :paramtype tenant_id: str :keyword client_secret_url: The client secret URL of the identity. :paramtype client_secret_url: str + :keyword user_assigned_identities: If Type is 'UserAssigned': List of user assigned identities. + :paramtype user_assigned_identities: dict[str, JSON] """ super().__init__(**kwargs) self.type = type self.principal_id = principal_id self.tenant_id = tenant_id self.client_secret_url = client_secret_url + self.user_assigned_identities = user_assigned_identities + + +class ImageVersionProperties(_serialization.Model): + """Properties for a shared image version. + + :ivar name: Image version name. + :vartype name: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Image version name. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name class ImportLabVirtualMachineRequest(_serialization.Model): - """This represents the payload required to import a virtual machine from a different lab into the current one. + """This represents the payload required to import a virtual machine from a different lab into the + current one. :ivar source_virtual_machine_resource_id: The full resource ID of the virtual machine to be imported. @@ -2577,8 +4526,8 @@ def __init__( *, source_virtual_machine_resource_id: Optional[str] = None, destination_virtual_machine_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_virtual_machine_resource_id: The full resource ID of the virtual machine to be imported. @@ -2593,7 +4542,8 @@ def __init__( class InboundNatRule(_serialization.Model): - """A rule for NAT - exposing a VM's port (backendPort) on the public IP address using a load balancer. + """A rule for NAT - exposing a VM's port (backendPort) on the public IP address using a load + balancer. :ivar transport_protocol: The transport protocol for the endpoint. Known values are: "Tcp" and "Udp". @@ -2617,8 +4567,8 @@ def __init__( transport_protocol: Optional[Union[str, "_models.TransportProtocol"]] = None, frontend_port: Optional[int] = None, backend_port: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword transport_protocol: The transport protocol for the endpoint. Known values are: "Tcp" and "Udp". @@ -2640,16 +4590,33 @@ class Lab(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar type_identity_type: Type of identity (SystemAssigned, UserAssigned, None). Known values + are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type_identity_type: str or ~azure.mgmt.devtestlabs.models.ManagedIdentityType + :ivar principal_id: The principal id of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant identifier of resource. + :vartype tenant_id: str + :ivar client_secret_url: The client secret URL of the identity. + :vartype client_secret_url: str + :ivar user_assigned_identities: If Type is 'UserAssigned': List of user assigned identities. + :vartype user_assigned_identities: dict[str, JSON] :ivar default_storage_account: The lab's default storage account. :vartype default_storage_account: str :ivar default_premium_storage_account: The lab's default premium storage account. @@ -2681,12 +4648,9 @@ class Lab(Resource): # pylint: disable=too-many-instance-attributes :ivar environment_permission: The access rights to be granted to the user when provisioning an environment. Known values are: "Reader" and "Contributor". :vartype environment_permission: str or ~azure.mgmt.devtestlabs.models.EnvironmentPermission - :ivar announcement: The properties of any lab announcement associated with this lab. - :vartype announcement: ~azure.mgmt.devtestlabs.models.LabAnnouncementProperties - :ivar support: The properties of any lab support message associated with this lab. - :vartype support: ~azure.mgmt.devtestlabs.models.LabSupportProperties - :ivar vm_creation_resource_group: The resource group in which all new lab virtual machines will - be created. To let DevTest Labs manage resource group creation, set this value to null. + :ivar vm_creation_resource_group: The resource group ID in which all new lab virtual machines + will be created. Ex: /subscriptions/subId/resourceGroups/rgName To let DevTest Labs manage + resource group creation, set this value to null. :vartype vm_creation_resource_group: str :ivar public_ip_id: The public IP address for the lab's load balancer. :vartype public_ip_id: str @@ -2697,16 +4661,65 @@ class Lab(Resource): # pylint: disable=too-many-instance-attributes :vartype network_security_group_id: str :ivar extended_properties: Extended properties of the lab used for experimental features. :vartype extended_properties: dict[str, str] - :ivar provisioning_state: The provisioning status of the resource. - :vartype provisioning_state: str - :ivar unique_identifier: The unique immutable identifier of a resource (Guid). - :vartype unique_identifier: str + :ivar browser_connect: Is browser connect enabled for the lab. Known values are: "Enabled" and + "Disabled". + :vartype browser_connect: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar disable_auto_upgrade_cse_minor_version: Is auto upgrade of CSE disabled for the lab?. + :vartype disable_auto_upgrade_cse_minor_version: bool + :ivar management_identities: List of identities which can be used for management of resources. + :vartype management_identities: dict[str, JSON] + :ivar isolate_lab_resources: Indicates whether to create Lab resources (e.g. Storage accounts + and Key Vaults) in network isolation. Known values are: "Enabled" and "Disabled". + :vartype isolate_lab_resources: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar default_secret_name: Default secret for creating virtual machines. + :vartype default_secret_name: str + :ivar provisioning_state_properties_provisioning_state: The provisioning status of the + resource. + :vartype provisioning_state_properties_provisioning_state: str + :ivar unique_identifier_properties_unique_identifier: The unique immutable identifier of a + resource (Guid). + :vartype unique_identifier_properties_unique_identifier: str + :ivar disk_encryption_set_id: Gets or sets resourceId of the disk encryption set to use for + enabling encryption at rest. + :vartype disk_encryption_set_id: str + :ivar type_properties_encryption_type: Gets or sets the type of key used to encrypt the data of + the disk. Possible values include: 'EncryptionAtRestWithPlatformKey', + 'EncryptionAtRestWithCustomerKey'. Known values are: "EncryptionAtRestWithPlatformKey" and + "EncryptionAtRestWithCustomerKey". + :vartype type_properties_encryption_type: str or ~azure.mgmt.devtestlabs.models.EncryptionType + :ivar enabled_properties_support_enabled: Is the lab support banner active/enabled at this + time?. Known values are: "Enabled" and "Disabled". + :vartype enabled_properties_support_enabled: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar markdown_properties_support_markdown: The markdown text (if any) that this lab displays + in the UI. If left empty/null, nothing will be shown. + :vartype markdown_properties_support_markdown: str + :ivar title: The plain text title for the lab announcement. + :vartype title: str + :ivar markdown_properties_announcement_markdown: The markdown text (if any) that this lab + displays in the UI. If left empty/null, nothing will be shown. + :vartype markdown_properties_announcement_markdown: str + :ivar enabled_properties_announcement_enabled: Is the lab announcement active/enabled at this + time?. Known values are: "Enabled" and "Disabled". + :vartype enabled_properties_announcement_enabled: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar expiration_date: The time at which the announcement expires (null for never). + :vartype expiration_date: ~datetime.datetime + :ivar expired: Has this announcement expired?. + :vartype expired: bool + :ivar provisioning_state_properties_announcement_provisioning_state: The provisioning status of + the resource. + :vartype provisioning_state_properties_announcement_provisioning_state: str + :ivar unique_identifier_properties_announcement_unique_identifier: The unique immutable + identifier of a resource (Guid). + :vartype unique_identifier_properties_announcement_unique_identifier: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "default_storage_account": {"readonly": True}, "default_premium_storage_account": {"readonly": True}, "artifacts_storage_account": {"readonly": True}, @@ -2717,16 +4730,24 @@ class Lab(Resource): # pylint: disable=too-many-instance-attributes "public_ip_id": {"readonly": True}, "load_balancer_id": {"readonly": True}, "network_security_group_id": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "unique_identifier": {"readonly": True}, + "provisioning_state_properties_provisioning_state": {"readonly": True}, + "unique_identifier_properties_unique_identifier": {"readonly": True}, + "provisioning_state_properties_announcement_provisioning_state": {"readonly": True}, + "unique_identifier_properties_announcement_unique_identifier": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "type_identity_type": {"key": "identity.type", "type": "str"}, + "principal_id": {"key": "identity.principalId", "type": "str"}, + "tenant_id": {"key": "identity.tenantId", "type": "str"}, + "client_secret_url": {"key": "identity.clientSecretUrl", "type": "str"}, + "user_assigned_identities": {"key": "identity.userAssignedIdentities", "type": "{object}"}, "default_storage_account": {"key": "properties.defaultStorageAccount", "type": "str"}, "default_premium_storage_account": {"key": "properties.defaultPremiumStorageAccount", "type": "str"}, "artifacts_storage_account": {"key": "properties.artifactsStorageAccount", "type": "str"}, @@ -2744,37 +4765,88 @@ class Lab(Resource): # pylint: disable=too-many-instance-attributes "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, "premium_data_disks": {"key": "properties.premiumDataDisks", "type": "str"}, "environment_permission": {"key": "properties.environmentPermission", "type": "str"}, - "announcement": {"key": "properties.announcement", "type": "LabAnnouncementProperties"}, - "support": {"key": "properties.support", "type": "LabSupportProperties"}, "vm_creation_resource_group": {"key": "properties.vmCreationResourceGroup", "type": "str"}, "public_ip_id": {"key": "properties.publicIpId", "type": "str"}, "load_balancer_id": {"key": "properties.loadBalancerId", "type": "str"}, "network_security_group_id": {"key": "properties.networkSecurityGroupId", "type": "str"}, "extended_properties": {"key": "properties.extendedProperties", "type": "{str}"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "browser_connect": {"key": "properties.browserConnect", "type": "str"}, + "disable_auto_upgrade_cse_minor_version": { + "key": "properties.disableAutoUpgradeCseMinorVersion", + "type": "bool", + }, + "management_identities": {"key": "properties.managementIdentities", "type": "{object}"}, + "isolate_lab_resources": {"key": "properties.isolateLabResources", "type": "str"}, + "default_secret_name": {"key": "properties.defaultSecretName", "type": "str"}, + "provisioning_state_properties_provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier_properties_unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "disk_encryption_set_id": {"key": "properties.encryption.diskEncryptionSetId", "type": "str"}, + "type_properties_encryption_type": {"key": "properties.encryption.type", "type": "str"}, + "enabled_properties_support_enabled": {"key": "properties.support.enabled", "type": "str"}, + "markdown_properties_support_markdown": {"key": "properties.support.markdown", "type": "str"}, + "title": {"key": "properties.announcement.title", "type": "str"}, + "markdown_properties_announcement_markdown": {"key": "properties.announcement.markdown", "type": "str"}, + "enabled_properties_announcement_enabled": {"key": "properties.announcement.enabled", "type": "str"}, + "expiration_date": {"key": "properties.announcement.expirationDate", "type": "iso-8601"}, + "expired": {"key": "properties.announcement.expired", "type": "bool"}, + "provisioning_state_properties_announcement_provisioning_state": { + "key": "properties.announcement.provisioningState", + "type": "str", + }, + "unique_identifier_properties_announcement_unique_identifier": { + "key": "properties.announcement.uniqueIdentifier", + "type": "str", + }, } def __init__( # pylint: disable=too-many-locals self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, + type_identity_type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + client_secret_url: Optional[str] = None, + user_assigned_identities: Optional[Dict[str, JSON]] = None, lab_storage_type: Optional[Union[str, "_models.StorageType"]] = None, mandatory_artifacts_resource_ids_linux: Optional[List[str]] = None, mandatory_artifacts_resource_ids_windows: Optional[List[str]] = None, premium_data_disks: Optional[Union[str, "_models.PremiumDataDisk"]] = None, environment_permission: Optional[Union[str, "_models.EnvironmentPermission"]] = None, - announcement: Optional["_models.LabAnnouncementProperties"] = None, - support: Optional["_models.LabSupportProperties"] = None, extended_properties: Optional[Dict[str, str]] = None, - **kwargs - ): + browser_connect: Optional[Union[str, "_models.EnableStatus"]] = None, + disable_auto_upgrade_cse_minor_version: Optional[bool] = None, + management_identities: Optional[Dict[str, JSON]] = None, + isolate_lab_resources: Optional[Union[str, "_models.EnableStatus"]] = None, + default_secret_name: Optional[str] = None, + disk_encryption_set_id: Optional[str] = None, + type_properties_encryption_type: Optional[Union[str, "_models.EncryptionType"]] = None, + enabled_properties_support_enabled: Optional[Union[str, "_models.EnableStatus"]] = None, + markdown_properties_support_markdown: Optional[str] = None, + title: Optional[str] = None, + markdown_properties_announcement_markdown: Optional[str] = None, + enabled_properties_announcement_enabled: Optional[Union[str, "_models.EnableStatus"]] = None, + expiration_date: Optional[datetime.datetime] = None, + expired: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword type_identity_type: Type of identity (SystemAssigned, UserAssigned, None). Known + values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :paramtype type_identity_type: str or ~azure.mgmt.devtestlabs.models.ManagedIdentityType + :keyword principal_id: The principal id of resource identity. + :paramtype principal_id: str + :keyword tenant_id: The tenant identifier of resource. + :paramtype tenant_id: str + :keyword client_secret_url: The client secret URL of the identity. + :paramtype client_secret_url: str + :keyword user_assigned_identities: If Type is 'UserAssigned': List of user assigned identities. + :paramtype user_assigned_identities: dict[str, JSON] :keyword lab_storage_type: Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Known values are: "Standard", "Premium", and "StandardSSD". :paramtype lab_storage_type: str or ~azure.mgmt.devtestlabs.models.StorageType @@ -2794,14 +4866,58 @@ def __init__( # pylint: disable=too-many-locals :keyword environment_permission: The access rights to be granted to the user when provisioning an environment. Known values are: "Reader" and "Contributor". :paramtype environment_permission: str or ~azure.mgmt.devtestlabs.models.EnvironmentPermission - :keyword announcement: The properties of any lab announcement associated with this lab. - :paramtype announcement: ~azure.mgmt.devtestlabs.models.LabAnnouncementProperties - :keyword support: The properties of any lab support message associated with this lab. - :paramtype support: ~azure.mgmt.devtestlabs.models.LabSupportProperties :keyword extended_properties: Extended properties of the lab used for experimental features. :paramtype extended_properties: dict[str, str] + :keyword browser_connect: Is browser connect enabled for the lab. Known values are: "Enabled" + and "Disabled". + :paramtype browser_connect: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword disable_auto_upgrade_cse_minor_version: Is auto upgrade of CSE disabled for the lab?. + :paramtype disable_auto_upgrade_cse_minor_version: bool + :keyword management_identities: List of identities which can be used for management of + resources. + :paramtype management_identities: dict[str, JSON] + :keyword isolate_lab_resources: Indicates whether to create Lab resources (e.g. Storage + accounts and Key Vaults) in network isolation. Known values are: "Enabled" and "Disabled". + :paramtype isolate_lab_resources: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword default_secret_name: Default secret for creating virtual machines. + :paramtype default_secret_name: str + :keyword disk_encryption_set_id: Gets or sets resourceId of the disk encryption set to use for + enabling encryption at rest. + :paramtype disk_encryption_set_id: str + :keyword type_properties_encryption_type: Gets or sets the type of key used to encrypt the data + of the disk. Possible values include: 'EncryptionAtRestWithPlatformKey', + 'EncryptionAtRestWithCustomerKey'. Known values are: "EncryptionAtRestWithPlatformKey" and + "EncryptionAtRestWithCustomerKey". + :paramtype type_properties_encryption_type: str or + ~azure.mgmt.devtestlabs.models.EncryptionType + :keyword enabled_properties_support_enabled: Is the lab support banner active/enabled at this + time?. Known values are: "Enabled" and "Disabled". + :paramtype enabled_properties_support_enabled: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword markdown_properties_support_markdown: The markdown text (if any) that this lab + displays in the UI. If left empty/null, nothing will be shown. + :paramtype markdown_properties_support_markdown: str + :keyword title: The plain text title for the lab announcement. + :paramtype title: str + :keyword markdown_properties_announcement_markdown: The markdown text (if any) that this lab + displays in the UI. If left empty/null, nothing will be shown. + :paramtype markdown_properties_announcement_markdown: str + :keyword enabled_properties_announcement_enabled: Is the lab announcement active/enabled at + this time?. Known values are: "Enabled" and "Disabled". + :paramtype enabled_properties_announcement_enabled: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword expiration_date: The time at which the announcement expires (null for never). + :paramtype expiration_date: ~datetime.datetime + :keyword expired: Has this announcement expired?. + :paramtype expired: bool """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.type_identity_type = type_identity_type + self.principal_id = principal_id + self.tenant_id = tenant_id + self.client_secret_url = client_secret_url + self.user_assigned_identities = user_assigned_identities self.default_storage_account = None self.default_premium_storage_account = None self.artifacts_storage_account = None @@ -2813,120 +4929,120 @@ def __init__( # pylint: disable=too-many-locals self.created_date = None self.premium_data_disks = premium_data_disks self.environment_permission = environment_permission - self.announcement = announcement - self.support = support self.vm_creation_resource_group = None self.public_ip_id = None self.load_balancer_id = None self.network_security_group_id = None self.extended_properties = extended_properties - self.provisioning_state = None - self.unique_identifier = None + self.browser_connect = browser_connect + self.disable_auto_upgrade_cse_minor_version = disable_auto_upgrade_cse_minor_version + self.management_identities = management_identities + self.isolate_lab_resources = isolate_lab_resources + self.default_secret_name = default_secret_name + self.provisioning_state_properties_provisioning_state = None + self.unique_identifier_properties_unique_identifier = None + self.disk_encryption_set_id = disk_encryption_set_id + self.type_properties_encryption_type = type_properties_encryption_type + self.enabled_properties_support_enabled = enabled_properties_support_enabled + self.markdown_properties_support_markdown = markdown_properties_support_markdown + self.title = title + self.markdown_properties_announcement_markdown = markdown_properties_announcement_markdown + self.enabled_properties_announcement_enabled = enabled_properties_announcement_enabled + self.expiration_date = expiration_date + self.expired = expired + self.provisioning_state_properties_announcement_provisioning_state = None + self.unique_identifier_properties_announcement_unique_identifier = None -class LabAnnouncementProperties(_serialization.Model): - """Properties of a lab's announcement banner. +class LabFragment(UpdateResource): + """Patch. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar tags: The tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + """ + super().__init__(tags=tags, identity=identity, **kwargs) + + +class LabList(_serialization.Model): + """Contains a list of labs and their properties. - :ivar title: The plain text title for the lab announcement. - :vartype title: str - :ivar markdown: The markdown text (if any) that this lab displays in the UI. If left - empty/null, nothing will be shown. - :vartype markdown: str - :ivar enabled: Is the lab announcement active/enabled at this time?. Known values are: - "Enabled" and "Disabled". - :vartype enabled: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :ivar expiration_date: The time at which the announcement expires (null for never). - :vartype expiration_date: ~datetime.datetime - :ivar expired: Has this announcement expired?. - :vartype expired: bool - :ivar provisioning_state: The provisioning status of the resource. - :vartype provisioning_state: str - :ivar unique_identifier: The unique immutable identifier of a resource (Guid). - :vartype unique_identifier: str + :ivar value: List of labs and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.Lab] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ - _validation = { - "provisioning_state": {"readonly": True}, - "unique_identifier": {"readonly": True}, - } - _attribute_map = { - "title": {"key": "title", "type": "str"}, - "markdown": {"key": "markdown", "type": "str"}, - "enabled": {"key": "enabled", "type": "str"}, - "expiration_date": {"key": "expirationDate", "type": "iso-8601"}, - "expired": {"key": "expired", "type": "bool"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "unique_identifier": {"key": "uniqueIdentifier", "type": "str"}, + "value": {"key": "value", "type": "[Lab]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - title: Optional[str] = None, - markdown: Optional[str] = None, - enabled: Optional[Union[str, "_models.EnableStatus"]] = None, - expiration_date: Optional[datetime.datetime] = None, - expired: Optional[bool] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Lab"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword title: The plain text title for the lab announcement. - :paramtype title: str - :keyword markdown: The markdown text (if any) that this lab displays in the UI. If left - empty/null, nothing will be shown. - :paramtype markdown: str - :keyword enabled: Is the lab announcement active/enabled at this time?. Known values are: - "Enabled" and "Disabled". - :paramtype enabled: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :keyword expiration_date: The time at which the announcement expires (null for never). - :paramtype expiration_date: ~datetime.datetime - :keyword expired: Has this announcement expired?. - :paramtype expired: bool + :keyword value: List of labs and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.Lab] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.title = title - self.markdown = markdown - self.enabled = enabled - self.expiration_date = expiration_date - self.expired = expired - self.provisioning_state = None - self.unique_identifier = None + self.value = value + self.next_link = next_link -class LabCost(Resource): # pylint: disable=too-many-instance-attributes - """A cost item. +class LabSecret(Resource): # pylint: disable=too-many-instance-attributes + """A shared secret in a lab. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar target_cost: The target cost properties. - :vartype target_cost: ~azure.mgmt.devtestlabs.models.TargetCostProperties - :ivar lab_cost_summary: The lab cost summary component of the cost data. - :vartype lab_cost_summary: ~azure.mgmt.devtestlabs.models.LabCostSummaryProperties - :ivar lab_cost_details: The lab cost details component of the cost data. - :vartype lab_cost_details: list[~azure.mgmt.devtestlabs.models.LabCostDetailsProperties] - :ivar resource_costs: The resource cost component of the cost data. - :vartype resource_costs: list[~azure.mgmt.devtestlabs.models.LabResourceCostProperties] - :ivar currency_code: The currency code of the cost. - :vartype currency_code: str - :ivar start_date_time: The start time of the cost data. - :vartype start_date_time: ~datetime.datetime - :ivar end_date_time: The end time of the cost data. - :vartype end_date_time: ~datetime.datetime - :ivar created_date: The creation date of the cost. - :vartype created_date: ~datetime.datetime + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar value: The value of the secret for secret creation. + :vartype value: str + :ivar key_vault_entry: The name of the entry in the lab KeyVault. + :vartype key_vault_entry: str + :ivar enabled_for_artifacts: Is the secret enabled for use with artifacts?. + :vartype enabled_for_artifacts: bool + :ivar enabled_for_vm_creation: Is the secret enabled for use with creation of VMs?. + :vartype enabled_for_vm_creation: bool + :ivar enabled_for_arm_environments: Is the secret enabled for use with ARM environments?. + :vartype enabled_for_arm_environments: bool :ivar provisioning_state: The provisioning status of the resource. :vartype provisioning_state: str :ivar unique_identifier: The unique immutable identifier of a resource (Guid). @@ -2937,9 +5053,9 @@ class LabCost(Resource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "lab_cost_summary": {"readonly": True}, - "lab_cost_details": {"readonly": True}, - "resource_costs": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "key_vault_entry": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, } @@ -2948,16 +5064,14 @@ class LabCost(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "target_cost": {"key": "properties.targetCost", "type": "TargetCostProperties"}, - "lab_cost_summary": {"key": "properties.labCostSummary", "type": "LabCostSummaryProperties"}, - "lab_cost_details": {"key": "properties.labCostDetails", "type": "[LabCostDetailsProperties]"}, - "resource_costs": {"key": "properties.resourceCosts", "type": "[LabResourceCostProperties]"}, - "currency_code": {"key": "properties.currencyCode", "type": "str"}, - "start_date_time": {"key": "properties.startDateTime", "type": "iso-8601"}, - "end_date_time": {"key": "properties.endDateTime", "type": "iso-8601"}, - "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "value": {"key": "properties.value", "type": "str"}, + "key_vault_entry": {"key": "properties.keyVaultEntry", "type": "str"}, + "enabled_for_artifacts": {"key": "properties.enabledForArtifacts", "type": "bool"}, + "enabled_for_vm_creation": {"key": "properties.enabledForVmCreation", "type": "bool"}, + "enabled_for_arm_environments": {"key": "properties.enabledForArmEnvironments", "type": "bool"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, } @@ -2965,143 +5079,90 @@ class LabCost(Resource): # pylint: disable=too-many-instance-attributes def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - target_cost: Optional["_models.TargetCostProperties"] = None, - currency_code: Optional[str] = None, - start_date_time: Optional[datetime.datetime] = None, - end_date_time: Optional[datetime.datetime] = None, - created_date: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + value: Optional[str] = None, + enabled_for_artifacts: Optional[bool] = None, + enabled_for_vm_creation: Optional[bool] = None, + enabled_for_arm_environments: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword target_cost: The target cost properties. - :paramtype target_cost: ~azure.mgmt.devtestlabs.models.TargetCostProperties - :keyword currency_code: The currency code of the cost. - :paramtype currency_code: str - :keyword start_date_time: The start time of the cost data. - :paramtype start_date_time: ~datetime.datetime - :keyword end_date_time: The end time of the cost data. - :paramtype end_date_time: ~datetime.datetime - :keyword created_date: The creation date of the cost. - :paramtype created_date: ~datetime.datetime - """ - super().__init__(location=location, tags=tags, **kwargs) - self.target_cost = target_cost - self.lab_cost_summary = None - self.lab_cost_details = None - self.resource_costs = None - self.currency_code = currency_code - self.start_date_time = start_date_time - self.end_date_time = end_date_time - self.created_date = created_date + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword value: The value of the secret for secret creation. + :paramtype value: str + :keyword enabled_for_artifacts: Is the secret enabled for use with artifacts?. + :paramtype enabled_for_artifacts: bool + :keyword enabled_for_vm_creation: Is the secret enabled for use with creation of VMs?. + :paramtype enabled_for_vm_creation: bool + :keyword enabled_for_arm_environments: Is the secret enabled for use with ARM environments?. + :paramtype enabled_for_arm_environments: bool + """ + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.value = value + self.key_vault_entry = None + self.enabled_for_artifacts = enabled_for_artifacts + self.enabled_for_vm_creation = enabled_for_vm_creation + self.enabled_for_arm_environments = enabled_for_arm_environments self.provisioning_state = None self.unique_identifier = None -class LabCostDetailsProperties(_serialization.Model): - """The properties of a lab cost item. - - :ivar date: The date of the cost item. - :vartype date: ~datetime.datetime - :ivar cost: The cost component of the cost item. - :vartype cost: float - :ivar cost_type: The type of the cost. Known values are: "Unavailable", "Reported", and - "Projected". - :vartype cost_type: str or ~azure.mgmt.devtestlabs.models.CostType - """ - - _attribute_map = { - "date": {"key": "date", "type": "iso-8601"}, - "cost": {"key": "cost", "type": "float"}, - "cost_type": {"key": "costType", "type": "str"}, - } - - def __init__( - self, - *, - date: Optional[datetime.datetime] = None, - cost: Optional[float] = None, - cost_type: Optional[Union[str, "_models.CostType"]] = None, - **kwargs - ): - """ - :keyword date: The date of the cost item. - :paramtype date: ~datetime.datetime - :keyword cost: The cost component of the cost item. - :paramtype cost: float - :keyword cost_type: The type of the cost. Known values are: "Unavailable", "Reported", and - "Projected". - :paramtype cost_type: str or ~azure.mgmt.devtestlabs.models.CostType - """ - super().__init__(**kwargs) - self.date = date - self.cost = cost - self.cost_type = cost_type - - -class LabCostSummaryProperties(_serialization.Model): - """The properties of the cost summary. - - :ivar estimated_lab_cost: The cost component of the cost item. - :vartype estimated_lab_cost: float - """ - - _attribute_map = { - "estimated_lab_cost": {"key": "estimatedLabCost", "type": "float"}, - } - - def __init__(self, *, estimated_lab_cost: Optional[float] = None, **kwargs): - """ - :keyword estimated_lab_cost: The cost component of the cost item. - :paramtype estimated_lab_cost: float - """ - super().__init__(**kwargs) - self.estimated_lab_cost = estimated_lab_cost - - -class LabFragment(UpdateResource): - """A lab. +class LabSecretFragment(UpdateResource): + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) -class LabList(_serialization.Model): - """The response of a list operation. +class LabSecretList(_serialization.Model): + """Contains a list of secrets and their properties. - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.Lab] - :ivar next_link: Link for next set of results. + :ivar value: List of secrets and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.LabSecret] + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Lab]"}, + "value": {"key": "value", "type": "[LabSecret]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Lab"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.LabSecret"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.Lab] - :keyword next_link: Link for next set of results. + :keyword value: List of secrets and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.LabSecret] + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -3109,119 +5170,6 @@ def __init__(self, *, value: Optional[List["_models.Lab"]] = None, next_link: Op self.next_link = next_link -class LabResourceCostProperties(_serialization.Model): - """The properties of a resource cost item. - - :ivar resourcename: The name of the resource. - :vartype resourcename: str - :ivar resource_u_id: The unique identifier of the resource. - :vartype resource_u_id: str - :ivar resource_cost: The cost component of the resource cost item. - :vartype resource_cost: float - :ivar resource_type: The logical resource type (ex. virtualmachine, storageaccount). - :vartype resource_type: str - :ivar resource_owner: The owner of the resource (ex. janedoe@microsoft.com). - :vartype resource_owner: str - :ivar resource_pricing_tier: The category of the resource (ex. Premium_LRS, Standard_DS1). - :vartype resource_pricing_tier: str - :ivar resource_status: The status of the resource (ex. Active). - :vartype resource_status: str - :ivar resource_id: The ID of the resource. - :vartype resource_id: str - :ivar external_resource_id: The ID of the external resource. - :vartype external_resource_id: str - """ - - _attribute_map = { - "resourcename": {"key": "resourcename", "type": "str"}, - "resource_u_id": {"key": "resourceUId", "type": "str"}, - "resource_cost": {"key": "resourceCost", "type": "float"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "resource_owner": {"key": "resourceOwner", "type": "str"}, - "resource_pricing_tier": {"key": "resourcePricingTier", "type": "str"}, - "resource_status": {"key": "resourceStatus", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "external_resource_id": {"key": "externalResourceId", "type": "str"}, - } - - def __init__( - self, - *, - resourcename: Optional[str] = None, - resource_u_id: Optional[str] = None, - resource_cost: Optional[float] = None, - resource_type: Optional[str] = None, - resource_owner: Optional[str] = None, - resource_pricing_tier: Optional[str] = None, - resource_status: Optional[str] = None, - resource_id: Optional[str] = None, - external_resource_id: Optional[str] = None, - **kwargs - ): - """ - :keyword resourcename: The name of the resource. - :paramtype resourcename: str - :keyword resource_u_id: The unique identifier of the resource. - :paramtype resource_u_id: str - :keyword resource_cost: The cost component of the resource cost item. - :paramtype resource_cost: float - :keyword resource_type: The logical resource type (ex. virtualmachine, storageaccount). - :paramtype resource_type: str - :keyword resource_owner: The owner of the resource (ex. janedoe@microsoft.com). - :paramtype resource_owner: str - :keyword resource_pricing_tier: The category of the resource (ex. Premium_LRS, Standard_DS1). - :paramtype resource_pricing_tier: str - :keyword resource_status: The status of the resource (ex. Active). - :paramtype resource_status: str - :keyword resource_id: The ID of the resource. - :paramtype resource_id: str - :keyword external_resource_id: The ID of the external resource. - :paramtype external_resource_id: str - """ - super().__init__(**kwargs) - self.resourcename = resourcename - self.resource_u_id = resource_u_id - self.resource_cost = resource_cost - self.resource_type = resource_type - self.resource_owner = resource_owner - self.resource_pricing_tier = resource_pricing_tier - self.resource_status = resource_status - self.resource_id = resource_id - self.external_resource_id = external_resource_id - - -class LabSupportProperties(_serialization.Model): - """Properties of a lab's support banner. - - :ivar enabled: Is the lab support banner active/enabled at this time?. Known values are: - "Enabled" and "Disabled". - :vartype enabled: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :ivar markdown: The markdown text (if any) that this lab displays in the UI. If left - empty/null, nothing will be shown. - :vartype markdown: str - """ - - _attribute_map = { - "enabled": {"key": "enabled", "type": "str"}, - "markdown": {"key": "markdown", "type": "str"}, - } - - def __init__( - self, *, enabled: Optional[Union[str, "_models.EnableStatus"]] = None, markdown: Optional[str] = None, **kwargs - ): - """ - :keyword enabled: Is the lab support banner active/enabled at this time?. Known values are: - "Enabled" and "Disabled". - :paramtype enabled: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :keyword markdown: The markdown text (if any) that this lab displays in the UI. If left - empty/null, nothing will be shown. - :paramtype markdown: str - """ - super().__init__(**kwargs) - self.enabled = enabled - self.markdown = markdown - - class LabVhd(_serialization.Model): """Properties of a VHD in the lab. @@ -3233,7 +5181,7 @@ class LabVhd(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The URI to the VHD. :paramtype id: str @@ -3243,11 +5191,11 @@ def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=re class LabVhdList(_serialization.Model): - """The response of a list operation. + """Contains a list of Lab Vhd and their properties. - :ivar value: Results of the list operation. + :ivar value: List of Lab Vhd and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.LabVhd] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -3256,11 +5204,13 @@ class LabVhdList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.LabVhd"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.LabVhd"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of Lab Vhd and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.LabVhd] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -3273,16 +5223,22 @@ class LabVirtualMachine(Resource): # pylint: disable=too-many-instance-attribut Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar notes: The notes of the virtual machine. :vartype notes: str :ivar owner_object_id: The object identifier of the owner of the virtual machine. @@ -3293,14 +5249,22 @@ class LabVirtualMachine(Resource): # pylint: disable=too-many-instance-attribut :vartype created_by_user_id: str :ivar created_by_user: The email address of creator of the virtual machine. :vartype created_by_user: str - :ivar created_date: The creation date of the virtual machine. - :vartype created_date: ~datetime.datetime + :ivar created_date_properties_created_date: The creation date of the virtual machine. + :vartype created_date_properties_created_date: ~datetime.datetime :ivar compute_id: The resource identifier (Microsoft.Compute) of the virtual machine. :vartype compute_id: str :ivar custom_image_id: The custom image identifier of the virtual machine. :vartype custom_image_id: str - :ivar os_type: The OS type of the virtual machine. - :vartype os_type: str + :ivar gallery_image_version_id: The shared gallery image version resource identifier of the + virtual machine. + :vartype gallery_image_version_id: str + :ivar shared_image_id: The shared image resource identifier of the virtual machine. + :vartype shared_image_id: str + :ivar shared_image_version: The shared image version for the specified shared image Id. Will + use latest if not specified. + :vartype shared_image_version: str + :ivar os_type_properties_os_type: The OS type of the virtual machine. + :vartype os_type_properties_os_type: str :ivar size: The size of the virtual machine. :vartype size: str :ivar user_name: The user name of the virtual machine. @@ -3323,26 +5287,18 @@ class LabVirtualMachine(Resource): # pylint: disable=too-many-instance-attribut :vartype disallow_public_ip_address: bool :ivar artifacts: The artifacts to be installed on the virtual machine. :vartype artifacts: list[~azure.mgmt.devtestlabs.models.ArtifactInstallProperties] - :ivar artifact_deployment_status: The artifact deployment status for the virtual machine. - :vartype artifact_deployment_status: - ~azure.mgmt.devtestlabs.models.ArtifactDeploymentStatusProperties - :ivar gallery_image_reference: The Microsoft Azure Marketplace image reference of the virtual - machine. - :vartype gallery_image_reference: ~azure.mgmt.devtestlabs.models.GalleryImageReference :ivar plan_id: The id of the plan associated with the virtual machine image. :vartype plan_id: str - :ivar compute_vm: The compute virtual machine properties. - :vartype compute_vm: ~azure.mgmt.devtestlabs.models.ComputeVmProperties - :ivar network_interface: The network interface properties. - :vartype network_interface: ~azure.mgmt.devtestlabs.models.NetworkInterfaceProperties - :ivar applicable_schedule: The applicable schedule for the virtual machine. - :vartype applicable_schedule: ~azure.mgmt.devtestlabs.models.ApplicableSchedule + :ivar os_disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can + be used to overwrite the size of the disk in a virtual machine image. + :vartype os_disk_size_gb: int :ivar expiration_date: The expiration date for VM. :vartype expiration_date: ~datetime.datetime :ivar allow_claim: Indicates whether another user can take ownership of the virtual machine. :vartype allow_claim: bool - :ivar storage_type: Storage type to use for virtual machine (i.e. Standard, Premium). - :vartype storage_type: str + :ivar storage_type: Storage type to use for virtual machine (i.e. Standard, Premium, + StandardSSD). Known values are: "Standard", "Premium", and "StandardSSD". + :vartype storage_type: str or ~azure.mgmt.devtestlabs.models.StorageTypes :ivar virtual_machine_creation_source: Tells source of creation of lab virtual machine. Output property only. Known values are: "FromCustomImage", "FromGalleryImage", and "FromSharedGalleryImage". @@ -3358,45 +5314,380 @@ class LabVirtualMachine(Resource): # pylint: disable=too-many-instance-attribut :vartype schedule_parameters: list[~azure.mgmt.devtestlabs.models.ScheduleCreationParameter] :ivar last_known_power_state: Last known compute power state captured in DTL. :vartype last_known_power_state: str - :ivar provisioning_state: The provisioning status of the resource. - :vartype provisioning_state: str - :ivar unique_identifier: The unique immutable identifier of a resource (Guid). - :vartype unique_identifier: str + :ivar can_apply_artifacts: Flag to determine if apply artifacts can be triggered at the time of + fetching the document. + :vartype can_apply_artifacts: bool + :ivar security_profile: Option to apply more security protection for VMs. + :vartype security_profile: ~azure.mgmt.devtestlabs.models.SecurityProfile + :ivar provisioning_state_properties_provisioning_state: The provisioning status of the + resource. + :vartype provisioning_state_properties_provisioning_state: str + :ivar unique_identifier_properties_unique_identifier: The unique immutable identifier of a + resource (Guid). + :vartype unique_identifier_properties_unique_identifier: str + :ivar id_properties_applicable_schedule_id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_id: str + :ivar name_properties_applicable_schedule_name: The name of the resource. + :vartype name_properties_applicable_schedule_name: str + :ivar type_properties_applicable_schedule_type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_type: str + :ivar tags_properties_applicable_schedule_tags: Resource tags. + :vartype tags_properties_applicable_schedule_tags: dict[str, str] + :ivar location_properties_applicable_schedule_location: The geo-location where the resource + lives. + :vartype location_properties_applicable_schedule_location: str + :ivar system_data_properties_applicable_schedule_system_data: The system metadata relating to + this resource. + :vartype system_data_properties_applicable_schedule_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar id_properties_applicable_schedule_properties_lab_vms_startup_id: Fully qualified resource + ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_properties_lab_vms_startup_id: str + :ivar name_properties_applicable_schedule_properties_lab_vms_startup_name: The name of the + resource. + :vartype name_properties_applicable_schedule_properties_lab_vms_startup_name: str + :ivar type_properties_applicable_schedule_properties_lab_vms_startup_type: The type of the + resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_properties_lab_vms_startup_type: str + :ivar tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Resource tags. + :vartype tags_properties_applicable_schedule_properties_lab_vms_startup_tags: dict[str, str] + :ivar location_properties_applicable_schedule_properties_lab_vms_startup_location: The + geo-location where the resource lives. + :vartype location_properties_applicable_schedule_properties_lab_vms_startup_location: str + :ivar system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data: The + system metadata relating to this resource. + :vartype system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: The + status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: + The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: str + :ivar + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :vartype + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + str + :ivar + created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date: + The creation date of the schedule. + :vartype + created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date: + ~datetime.datetime + :ivar + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + The resource ID to which the schedule belongs. + :vartype + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + str + :ivar + provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state: + The provisioning status of the resource. + :vartype + provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state: + str + :ivar + unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier: + The unique immutable identifier of a resource (Guid). + :vartype + unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier: + str + :ivar + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :ivar + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :vartype + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :ivar + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :vartype + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + int + :ivar + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + The time of day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + str + :ivar + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + list[str] + :ivar + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + str + :ivar id_properties_applicable_schedule_properties_lab_vms_shutdown_id: Fully qualified + resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_properties_lab_vms_shutdown_id: str + :ivar name_properties_applicable_schedule_properties_lab_vms_shutdown_name: The name of the + resource. + :vartype name_properties_applicable_schedule_properties_lab_vms_shutdown_name: str + :ivar type_properties_applicable_schedule_properties_lab_vms_shutdown_type: The type of the + resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_properties_lab_vms_shutdown_type: str + :ivar tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Resource tags. + :vartype tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: dict[str, str] + :ivar location_properties_applicable_schedule_properties_lab_vms_shutdown_location: The + geo-location where the resource lives. + :vartype location_properties_applicable_schedule_properties_lab_vms_shutdown_location: str + :ivar system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data: The + system metadata relating to this resource. + :vartype system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: The + status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: str + :ivar + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :vartype + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + str + :ivar + created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date: + The creation date of the schedule. + :vartype + created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date: + ~datetime.datetime + :ivar + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + The resource ID to which the schedule belongs. + :vartype + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + str + :ivar + provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state: + The provisioning status of the resource. + :vartype + provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state: + str + :ivar + unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier: + The unique immutable identifier of a resource (Guid). + :vartype + unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier: + str + :ivar + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :ivar + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :vartype + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :ivar + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :vartype + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + int + :ivar + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + The time of day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + str + :ivar + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :ivar + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + str + :ivar virtual_network_id: The resource ID of the virtual network. + :vartype virtual_network_id: str + :ivar subnet_id: The resource ID of the sub net. + :vartype subnet_id: str + :ivar public_ip_address_id: The resource ID of the public IP address. + :vartype public_ip_address_id: str + :ivar public_ip_address: The public IP address. + :vartype public_ip_address: str + :ivar private_ip_address: The private IP address. + :vartype private_ip_address: str + :ivar dns_name: The DNS name. + :vartype dns_name: str + :ivar rdp_authority: The RdpAuthority property is a server DNS host name or IP address followed + by the service port number for RDP (Remote Desktop Protocol). + :vartype rdp_authority: str + :ivar ssh_authority: The SshAuthority property is a server DNS host name or IP address followed + by the service port number for SSH. + :vartype ssh_authority: str + :ivar inbound_nat_rules: The incoming NAT rules. + :vartype inbound_nat_rules: list[~azure.mgmt.devtestlabs.models.InboundNatRule] + :ivar statuses: Gets the statuses of the virtual machine. + :vartype statuses: list[~azure.mgmt.devtestlabs.models.ComputeVmInstanceViewStatus] + :ivar os_type_properties_compute_vm_os_type: Gets the OS type of the virtual machine. + :vartype os_type_properties_compute_vm_os_type: str + :ivar vm_size: Gets the size of the virtual machine. + :vartype vm_size: str + :ivar network_interface_id: Gets the network interface ID of the virtual machine. + :vartype network_interface_id: str + :ivar os_disk_id: Gets OS disk blob uri for the virtual machine. + :vartype os_disk_id: str + :ivar data_disk_ids: Gets data disks blob uri for the virtual machine. + :vartype data_disk_ids: list[str] + :ivar data_disks: Gets all data disks attached to the virtual machine. + :vartype data_disks: list[~azure.mgmt.devtestlabs.models.ComputeDataDisk] + :ivar offer: The offer of the gallery image. + :vartype offer: str + :ivar publisher: The publisher of the gallery image. + :vartype publisher: str + :ivar sku: The SKU of the gallery image. + :vartype sku: str + :ivar os_type_properties_gallery_image_reference_os_type: The OS type of the gallery image. + :vartype os_type_properties_gallery_image_reference_os_type: str + :ivar version: The version of the gallery image. + :vartype version: str + :ivar deployment_status: The deployment status of the artifact. + :vartype deployment_status: str + :ivar artifacts_applied: The total count of the artifacts that were successfully applied. + :vartype artifacts_applied: int + :ivar total_artifacts: The total count of the artifacts that were tentatively applied. + :vartype total_artifacts: int """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "created_by_user_id": {"readonly": True}, "created_by_user": {"readonly": True}, "compute_id": {"readonly": True}, - "os_type": {"readonly": True}, + "os_type_properties_os_type": {"readonly": True}, "fqdn": {"readonly": True}, - "artifact_deployment_status": {"readonly": True}, - "compute_vm": {"readonly": True}, - "applicable_schedule": {"readonly": True}, "virtual_machine_creation_source": {"readonly": True}, "last_known_power_state": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "unique_identifier": {"readonly": True}, + "can_apply_artifacts": {"readonly": True}, + "provisioning_state_properties_provisioning_state": {"readonly": True}, + "unique_identifier_properties_unique_identifier": {"readonly": True}, + "id_properties_applicable_schedule_id": {"readonly": True}, + "name_properties_applicable_schedule_name": {"readonly": True}, + "type_properties_applicable_schedule_type": {"readonly": True}, + "system_data_properties_applicable_schedule_system_data": {"readonly": True}, + "id_properties_applicable_schedule_properties_lab_vms_startup_id": {"readonly": True}, + "name_properties_applicable_schedule_properties_lab_vms_startup_name": {"readonly": True}, + "type_properties_applicable_schedule_properties_lab_vms_startup_type": {"readonly": True}, + "system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data": {"readonly": True}, + "created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date": { + "readonly": True + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state": { + "readonly": True + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier": { + "readonly": True + }, + "id_properties_applicable_schedule_properties_lab_vms_shutdown_id": {"readonly": True}, + "name_properties_applicable_schedule_properties_lab_vms_shutdown_name": {"readonly": True}, + "type_properties_applicable_schedule_properties_lab_vms_shutdown_type": {"readonly": True}, + "system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data": {"readonly": True}, + "created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date": { + "readonly": True + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state": { + "readonly": True + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier": { + "readonly": True + }, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "notes": {"key": "properties.notes", "type": "str"}, "owner_object_id": {"key": "properties.ownerObjectId", "type": "str"}, "owner_user_principal_name": {"key": "properties.ownerUserPrincipalName", "type": "str"}, "created_by_user_id": {"key": "properties.createdByUserId", "type": "str"}, "created_by_user": {"key": "properties.createdByUser", "type": "str"}, - "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, + "created_date_properties_created_date": {"key": "properties.createdDate", "type": "iso-8601"}, "compute_id": {"key": "properties.computeId", "type": "str"}, "custom_image_id": {"key": "properties.customImageId", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, + "gallery_image_version_id": {"key": "properties.galleryImageVersionId", "type": "str"}, + "shared_image_id": {"key": "properties.sharedImageId", "type": "str"}, + "shared_image_version": {"key": "properties.sharedImageVersion", "type": "str"}, + "os_type_properties_os_type": {"key": "properties.osType", "type": "str"}, "size": {"key": "properties.size", "type": "str"}, "user_name": {"key": "properties.userName", "type": "str"}, "password": {"key": "properties.password", "type": "str"}, @@ -3407,37 +5698,253 @@ class LabVirtualMachine(Resource): # pylint: disable=too-many-instance-attribut "lab_virtual_network_id": {"key": "properties.labVirtualNetworkId", "type": "str"}, "disallow_public_ip_address": {"key": "properties.disallowPublicIpAddress", "type": "bool"}, "artifacts": {"key": "properties.artifacts", "type": "[ArtifactInstallProperties]"}, - "artifact_deployment_status": { - "key": "properties.artifactDeploymentStatus", - "type": "ArtifactDeploymentStatusProperties", + "plan_id": {"key": "properties.planId", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGb", "type": "int"}, + "expiration_date": {"key": "properties.expirationDate", "type": "iso-8601"}, + "allow_claim": {"key": "properties.allowClaim", "type": "bool"}, + "storage_type": {"key": "properties.storageType", "type": "str"}, + "virtual_machine_creation_source": {"key": "properties.virtualMachineCreationSource", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "data_disk_parameters": {"key": "properties.dataDiskParameters", "type": "[DataDiskProperties]"}, + "schedule_parameters": {"key": "properties.scheduleParameters", "type": "[ScheduleCreationParameter]"}, + "last_known_power_state": {"key": "properties.lastKnownPowerState", "type": "str"}, + "can_apply_artifacts": {"key": "properties.canApplyArtifacts", "type": "bool"}, + "security_profile": {"key": "properties.securityProfile", "type": "SecurityProfile"}, + "provisioning_state_properties_provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier_properties_unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "id_properties_applicable_schedule_id": {"key": "properties.applicableSchedule.id", "type": "str"}, + "name_properties_applicable_schedule_name": {"key": "properties.applicableSchedule.name", "type": "str"}, + "type_properties_applicable_schedule_type": {"key": "properties.applicableSchedule.type", "type": "str"}, + "tags_properties_applicable_schedule_tags": {"key": "properties.applicableSchedule.tags", "type": "{str}"}, + "location_properties_applicable_schedule_location": { + "key": "properties.applicableSchedule.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_system_data": { + "key": "properties.applicableSchedule.systemData", + "type": "SystemData", + }, + "id_properties_applicable_schedule_properties_lab_vms_startup_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.id", + "type": "str", + }, + "name_properties_applicable_schedule_properties_lab_vms_startup_name": { + "key": "properties.applicableSchedule.properties.labVmsStartup.name", + "type": "str", + }, + "type_properties_applicable_schedule_properties_lab_vms_startup_type": { + "key": "properties.applicableSchedule.properties.labVmsStartup.type", + "type": "str", + }, + "tags_properties_applicable_schedule_properties_lab_vms_startup_tags": { + "key": "properties.applicableSchedule.properties.labVmsStartup.tags", + "type": "{str}", + }, + "location_properties_applicable_schedule_properties_lab_vms_startup_location": { + "key": "properties.applicableSchedule.properties.labVmsStartup.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data": { + "key": "properties.applicableSchedule.properties.labVmsStartup.systemData", + "type": "SystemData", + }, + "status_properties_applicable_schedule_properties_lab_vms_startup_properties_status": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.status", + "type": "str", + }, + "task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.weeklyRecurrence.time", + "type": "str", + }, + "id_properties_applicable_schedule_properties_lab_vms_shutdown_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.id", + "type": "str", + }, + "name_properties_applicable_schedule_properties_lab_vms_shutdown_name": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.name", + "type": "str", + }, + "type_properties_applicable_schedule_properties_lab_vms_shutdown_type": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.type", + "type": "str", + }, + "tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.tags", + "type": "{str}", + }, + "location_properties_applicable_schedule_properties_lab_vms_shutdown_location": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.systemData", + "type": "SystemData", + }, + "status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.status", + "type": "str", }, - "gallery_image_reference": {"key": "properties.galleryImageReference", "type": "GalleryImageReference"}, - "plan_id": {"key": "properties.planId", "type": "str"}, - "compute_vm": {"key": "properties.computeVm", "type": "ComputeVmProperties"}, - "network_interface": {"key": "properties.networkInterface", "type": "NetworkInterfaceProperties"}, - "applicable_schedule": {"key": "properties.applicableSchedule", "type": "ApplicableSchedule"}, - "expiration_date": {"key": "properties.expirationDate", "type": "iso-8601"}, - "allow_claim": {"key": "properties.allowClaim", "type": "bool"}, - "storage_type": {"key": "properties.storageType", "type": "str"}, - "virtual_machine_creation_source": {"key": "properties.virtualMachineCreationSource", "type": "str"}, - "environment_id": {"key": "properties.environmentId", "type": "str"}, - "data_disk_parameters": {"key": "properties.dataDiskParameters", "type": "[DataDiskProperties]"}, - "schedule_parameters": {"key": "properties.scheduleParameters", "type": "[ScheduleCreationParameter]"}, - "last_known_power_state": {"key": "properties.lastKnownPowerState", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.weeklyRecurrence.time", + "type": "str", + }, + "virtual_network_id": {"key": "properties.networkInterface.virtualNetworkId", "type": "str"}, + "subnet_id": {"key": "properties.networkInterface.subnetId", "type": "str"}, + "public_ip_address_id": {"key": "properties.networkInterface.publicIpAddressId", "type": "str"}, + "public_ip_address": {"key": "properties.networkInterface.publicIpAddress", "type": "str"}, + "private_ip_address": {"key": "properties.networkInterface.privateIpAddress", "type": "str"}, + "dns_name": {"key": "properties.networkInterface.dnsName", "type": "str"}, + "rdp_authority": {"key": "properties.networkInterface.rdpAuthority", "type": "str"}, + "ssh_authority": {"key": "properties.networkInterface.sshAuthority", "type": "str"}, + "inbound_nat_rules": { + "key": "properties.networkInterface.sharedPublicIpAddressConfiguration.inboundNatRules", + "type": "[InboundNatRule]", + }, + "statuses": {"key": "properties.computeVm.statuses", "type": "[ComputeVmInstanceViewStatus]"}, + "os_type_properties_compute_vm_os_type": {"key": "properties.computeVm.osType", "type": "str"}, + "vm_size": {"key": "properties.computeVm.vmSize", "type": "str"}, + "network_interface_id": {"key": "properties.computeVm.networkInterfaceId", "type": "str"}, + "os_disk_id": {"key": "properties.computeVm.osDiskId", "type": "str"}, + "data_disk_ids": {"key": "properties.computeVm.dataDiskIds", "type": "[str]"}, + "data_disks": {"key": "properties.computeVm.dataDisks", "type": "[ComputeDataDisk]"}, + "offer": {"key": "properties.galleryImageReference.offer", "type": "str"}, + "publisher": {"key": "properties.galleryImageReference.publisher", "type": "str"}, + "sku": {"key": "properties.galleryImageReference.sku", "type": "str"}, + "os_type_properties_gallery_image_reference_os_type": { + "key": "properties.galleryImageReference.osType", + "type": "str", + }, + "version": {"key": "properties.galleryImageReference.version", "type": "str"}, + "deployment_status": {"key": "properties.artifactDeploymentStatus.deploymentStatus", "type": "str"}, + "artifacts_applied": {"key": "properties.artifactDeploymentStatus.artifactsApplied", "type": "int"}, + "total_artifacts": {"key": "properties.artifactDeploymentStatus.totalArtifacts", "type": "int"}, } def __init__( # pylint: disable=too-many-locals self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, notes: Optional[str] = None, owner_object_id: str = "dynamicValue", owner_user_principal_name: Optional[str] = None, - created_date: Optional[datetime.datetime] = None, + created_date_properties_created_date: Optional[datetime.datetime] = None, custom_image_id: Optional[str] = None, + gallery_image_version_id: Optional[str] = None, + shared_image_id: Optional[str] = None, + shared_image_version: Optional[str] = None, size: Optional[str] = None, user_name: Optional[str] = None, password: Optional[str] = None, @@ -3447,32 +5954,144 @@ def __init__( # pylint: disable=too-many-locals lab_virtual_network_id: Optional[str] = None, disallow_public_ip_address: bool = False, artifacts: Optional[List["_models.ArtifactInstallProperties"]] = None, - gallery_image_reference: Optional["_models.GalleryImageReference"] = None, plan_id: Optional[str] = None, - network_interface: Optional["_models.NetworkInterfaceProperties"] = None, + os_disk_size_gb: Optional[int] = None, expiration_date: Optional[datetime.datetime] = None, allow_claim: bool = False, - storage_type: str = "labStorageType", + storage_type: Union[str, "_models.StorageTypes"] = "Standard", environment_id: Optional[str] = None, data_disk_parameters: Optional[List["_models.DataDiskProperties"]] = None, schedule_parameters: Optional[List["_models.ScheduleCreationParameter"]] = None, - **kwargs - ): + security_profile: Optional["_models.SecurityProfile"] = None, + tags_properties_applicable_schedule_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_location: Optional[str] = None, + tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_properties_lab_vms_startup_location: Optional[str] = None, + status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: Optional[str] = None, + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: Optional[ + str + ] = None, + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: Optional[ + str + ] = None, + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: Optional[ + str + ] = None, + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: Optional[ + int + ] = None, + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: Optional[ + str + ] = None, + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: Optional[ + List[str] + ] = None, + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: Optional[ + str + ] = None, + tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_properties_lab_vms_shutdown_location: Optional[str] = None, + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: Optional[str] = None, + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: Optional[ + str + ] = None, + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: Optional[ + str + ] = None, + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: Optional[ + str + ] = None, + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: Optional[ + int + ] = None, + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: Optional[ + str + ] = None, + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: Optional[ + List[str] + ] = None, + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: Optional[ + str + ] = None, + virtual_network_id: Optional[str] = None, + subnet_id: Optional[str] = None, + public_ip_address_id: Optional[str] = None, + public_ip_address: Optional[str] = None, + private_ip_address: Optional[str] = None, + dns_name: Optional[str] = None, + rdp_authority: Optional[str] = None, + ssh_authority: Optional[str] = None, + inbound_nat_rules: Optional[List["_models.InboundNatRule"]] = None, + statuses: Optional[List["_models.ComputeVmInstanceViewStatus"]] = None, + os_type_properties_compute_vm_os_type: Optional[str] = None, + vm_size: Optional[str] = None, + network_interface_id: Optional[str] = None, + os_disk_id: Optional[str] = None, + data_disk_ids: Optional[List[str]] = None, + data_disks: Optional[List["_models.ComputeDataDisk"]] = None, + offer: Optional[str] = None, + publisher: Optional[str] = None, + sku: Optional[str] = None, + os_type_properties_gallery_image_reference_os_type: Optional[str] = None, + version: Optional[str] = None, + deployment_status: Optional[str] = None, + artifacts_applied: Optional[int] = None, + total_artifacts: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword notes: The notes of the virtual machine. :paramtype notes: str :keyword owner_object_id: The object identifier of the owner of the virtual machine. :paramtype owner_object_id: str :keyword owner_user_principal_name: The user principal name of the virtual machine owner. :paramtype owner_user_principal_name: str - :keyword created_date: The creation date of the virtual machine. - :paramtype created_date: ~datetime.datetime + :keyword created_date_properties_created_date: The creation date of the virtual machine. + :paramtype created_date_properties_created_date: ~datetime.datetime :keyword custom_image_id: The custom image identifier of the virtual machine. :paramtype custom_image_id: str + :keyword gallery_image_version_id: The shared gallery image version resource identifier of the + virtual machine. + :paramtype gallery_image_version_id: str + :keyword shared_image_id: The shared image resource identifier of the virtual machine. + :paramtype shared_image_id: str + :keyword shared_image_version: The shared image version for the specified shared image Id. Will + use latest if not specified. + :paramtype shared_image_version: str :keyword size: The size of the virtual machine. :paramtype size: str :keyword user_name: The user name of the virtual machine. @@ -3493,19 +6112,18 @@ def __init__( # pylint: disable=too-many-locals :paramtype disallow_public_ip_address: bool :keyword artifacts: The artifacts to be installed on the virtual machine. :paramtype artifacts: list[~azure.mgmt.devtestlabs.models.ArtifactInstallProperties] - :keyword gallery_image_reference: The Microsoft Azure Marketplace image reference of the - virtual machine. - :paramtype gallery_image_reference: ~azure.mgmt.devtestlabs.models.GalleryImageReference :keyword plan_id: The id of the plan associated with the virtual machine image. :paramtype plan_id: str - :keyword network_interface: The network interface properties. - :paramtype network_interface: ~azure.mgmt.devtestlabs.models.NetworkInterfaceProperties + :keyword os_disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element + can be used to overwrite the size of the disk in a virtual machine image. + :paramtype os_disk_size_gb: int :keyword expiration_date: The expiration date for VM. :paramtype expiration_date: ~datetime.datetime :keyword allow_claim: Indicates whether another user can take ownership of the virtual machine. :paramtype allow_claim: bool - :keyword storage_type: Storage type to use for virtual machine (i.e. Standard, Premium). - :paramtype storage_type: str + :keyword storage_type: Storage type to use for virtual machine (i.e. Standard, Premium, + StandardSSD). Known values are: "Standard", "Premium", and "StandardSSD". + :paramtype storage_type: str or ~azure.mgmt.devtestlabs.models.StorageTypes :keyword environment_id: The resource ID of the environment that contains this virtual machine, if any. :paramtype environment_id: str @@ -3514,17 +6132,244 @@ def __init__( # pylint: disable=too-many-locals :paramtype data_disk_parameters: list[~azure.mgmt.devtestlabs.models.DataDiskProperties] :keyword schedule_parameters: Virtual Machine schedules to be created. :paramtype schedule_parameters: list[~azure.mgmt.devtestlabs.models.ScheduleCreationParameter] + :keyword security_profile: Option to apply more security protection for VMs. + :paramtype security_profile: ~azure.mgmt.devtestlabs.models.SecurityProfile + :keyword tags_properties_applicable_schedule_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_tags: dict[str, str] + :keyword location_properties_applicable_schedule_location: The geo-location where the resource + lives. + :paramtype location_properties_applicable_schedule_location: str + :keyword tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_properties_lab_vms_startup_tags: dict[str, str] + :keyword location_properties_applicable_schedule_properties_lab_vms_startup_location: The + geo-location where the resource lives. + :paramtype location_properties_applicable_schedule_properties_lab_vms_startup_location: str + :keyword status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :paramtype status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: str + :keyword + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :paramtype + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + str + :keyword + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + The resource ID to which the schedule belongs. + :paramtype + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + str + :keyword + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :keyword + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :keyword + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :paramtype + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + int + :keyword + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + The time of day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + str + :keyword + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + list[str] + :keyword + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + str + :keyword tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: dict[str, str] + :keyword location_properties_applicable_schedule_properties_lab_vms_shutdown_location: The + geo-location where the resource lives. + :paramtype location_properties_applicable_schedule_properties_lab_vms_shutdown_location: str + :keyword status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :paramtype status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: str + :keyword + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :paramtype + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + str + :keyword + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + The resource ID to which the schedule belongs. + :paramtype + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + str + :keyword + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :keyword + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :keyword + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :paramtype + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + int + :keyword + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + The time of day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + str + :keyword + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :keyword + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + str + :keyword virtual_network_id: The resource ID of the virtual network. + :paramtype virtual_network_id: str + :keyword subnet_id: The resource ID of the sub net. + :paramtype subnet_id: str + :keyword public_ip_address_id: The resource ID of the public IP address. + :paramtype public_ip_address_id: str + :keyword public_ip_address: The public IP address. + :paramtype public_ip_address: str + :keyword private_ip_address: The private IP address. + :paramtype private_ip_address: str + :keyword dns_name: The DNS name. + :paramtype dns_name: str + :keyword rdp_authority: The RdpAuthority property is a server DNS host name or IP address + followed by the service port number for RDP (Remote Desktop Protocol). + :paramtype rdp_authority: str + :keyword ssh_authority: The SshAuthority property is a server DNS host name or IP address + followed by the service port number for SSH. + :paramtype ssh_authority: str + :keyword inbound_nat_rules: The incoming NAT rules. + :paramtype inbound_nat_rules: list[~azure.mgmt.devtestlabs.models.InboundNatRule] + :keyword statuses: Gets the statuses of the virtual machine. + :paramtype statuses: list[~azure.mgmt.devtestlabs.models.ComputeVmInstanceViewStatus] + :keyword os_type_properties_compute_vm_os_type: Gets the OS type of the virtual machine. + :paramtype os_type_properties_compute_vm_os_type: str + :keyword vm_size: Gets the size of the virtual machine. + :paramtype vm_size: str + :keyword network_interface_id: Gets the network interface ID of the virtual machine. + :paramtype network_interface_id: str + :keyword os_disk_id: Gets OS disk blob uri for the virtual machine. + :paramtype os_disk_id: str + :keyword data_disk_ids: Gets data disks blob uri for the virtual machine. + :paramtype data_disk_ids: list[str] + :keyword data_disks: Gets all data disks attached to the virtual machine. + :paramtype data_disks: list[~azure.mgmt.devtestlabs.models.ComputeDataDisk] + :keyword offer: The offer of the gallery image. + :paramtype offer: str + :keyword publisher: The publisher of the gallery image. + :paramtype publisher: str + :keyword sku: The SKU of the gallery image. + :paramtype sku: str + :keyword os_type_properties_gallery_image_reference_os_type: The OS type of the gallery image. + :paramtype os_type_properties_gallery_image_reference_os_type: str + :keyword version: The version of the gallery image. + :paramtype version: str + :keyword deployment_status: The deployment status of the artifact. + :paramtype deployment_status: str + :keyword artifacts_applied: The total count of the artifacts that were successfully applied. + :paramtype artifacts_applied: int + :keyword total_artifacts: The total count of the artifacts that were tentatively applied. + :paramtype total_artifacts: int """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.notes = notes self.owner_object_id = owner_object_id self.owner_user_principal_name = owner_user_principal_name self.created_by_user_id = None self.created_by_user = None - self.created_date = created_date + self.created_date_properties_created_date = created_date_properties_created_date self.compute_id = None self.custom_image_id = custom_image_id - self.os_type = None + self.gallery_image_version_id = gallery_image_version_id + self.shared_image_id = shared_image_id + self.shared_image_version = shared_image_version + self.os_type_properties_os_type = None self.size = size self.user_name = user_name self.password = password @@ -3535,12 +6380,8 @@ def __init__( # pylint: disable=too-many-locals self.lab_virtual_network_id = lab_virtual_network_id self.disallow_public_ip_address = disallow_public_ip_address self.artifacts = artifacts - self.artifact_deployment_status = None - self.gallery_image_reference = gallery_image_reference self.plan_id = plan_id - self.compute_vm = None - self.network_interface = network_interface - self.applicable_schedule = None + self.os_disk_size_gb = os_disk_size_gb self.expiration_date = expiration_date self.allow_claim = allow_claim self.storage_type = storage_type @@ -3549,31 +6390,175 @@ def __init__( # pylint: disable=too-many-locals self.data_disk_parameters = data_disk_parameters self.schedule_parameters = schedule_parameters self.last_known_power_state = None - self.provisioning_state = None - self.unique_identifier = None + self.can_apply_artifacts = None + self.security_profile = security_profile + self.provisioning_state_properties_provisioning_state = None + self.unique_identifier_properties_unique_identifier = None + self.id_properties_applicable_schedule_id = None + self.name_properties_applicable_schedule_name = None + self.type_properties_applicable_schedule_type = None + self.tags_properties_applicable_schedule_tags = tags_properties_applicable_schedule_tags + self.location_properties_applicable_schedule_location = location_properties_applicable_schedule_location + self.system_data_properties_applicable_schedule_system_data = None + self.id_properties_applicable_schedule_properties_lab_vms_startup_id = None + self.name_properties_applicable_schedule_properties_lab_vms_startup_name = None + self.type_properties_applicable_schedule_properties_lab_vms_startup_type = None + self.tags_properties_applicable_schedule_properties_lab_vms_startup_tags = ( + tags_properties_applicable_schedule_properties_lab_vms_startup_tags + ) + self.location_properties_applicable_schedule_properties_lab_vms_startup_location = ( + location_properties_applicable_schedule_properties_lab_vms_startup_location + ) + self.system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data = None + self.status_properties_applicable_schedule_properties_lab_vms_startup_properties_status = ( + status_properties_applicable_schedule_properties_lab_vms_startup_properties_status + ) + self.task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type = ( + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type + ) + self.time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id = ( + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id + ) + self.created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date = None + self.target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id = ( + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id + ) + self.provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state = ( + None + ) + self.unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier = ( + None + ) + self.status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status = ( + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status + ) + self.time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes = time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes + self.webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url = webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url + self.email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient = email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient + self.notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale = notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale + self.minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute = ( + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute + ) + self.time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time + ) + self.weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays = ( + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays + ) + self.time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time + ) + self.id_properties_applicable_schedule_properties_lab_vms_shutdown_id = None + self.name_properties_applicable_schedule_properties_lab_vms_shutdown_name = None + self.type_properties_applicable_schedule_properties_lab_vms_shutdown_type = None + self.tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags = ( + tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags + ) + self.location_properties_applicable_schedule_properties_lab_vms_shutdown_location = ( + location_properties_applicable_schedule_properties_lab_vms_shutdown_location + ) + self.system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data = None + self.status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status = ( + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status + ) + self.task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type = ( + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type + ) + self.time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id = ( + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id + ) + self.created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date = None + self.target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id = ( + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id + ) + self.provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state = ( + None + ) + self.unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier = ( + None + ) + self.status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status = ( + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status + ) + self.time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes = time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes + self.webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url = webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url + self.email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient = email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient + self.notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale = notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale + self.minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute = ( + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute + ) + self.time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time + ) + self.weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays = ( + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays + ) + self.time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time + ) + self.virtual_network_id = virtual_network_id + self.subnet_id = subnet_id + self.public_ip_address_id = public_ip_address_id + self.public_ip_address = public_ip_address + self.private_ip_address = private_ip_address + self.dns_name = dns_name + self.rdp_authority = rdp_authority + self.ssh_authority = ssh_authority + self.inbound_nat_rules = inbound_nat_rules + self.statuses = statuses + self.os_type_properties_compute_vm_os_type = os_type_properties_compute_vm_os_type + self.vm_size = vm_size + self.network_interface_id = network_interface_id + self.os_disk_id = os_disk_id + self.data_disk_ids = data_disk_ids + self.data_disks = data_disks + self.offer = offer + self.publisher = publisher + self.sku = sku + self.os_type_properties_gallery_image_reference_os_type = os_type_properties_gallery_image_reference_os_type + self.version = version + self.deployment_status = deployment_status + self.artifacts_applied = artifacts_applied + self.total_artifacts = total_artifacts class LabVirtualMachineCreationParameter(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for creating a virtual machine. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar name: The name of the virtual machine or environment. :vartype name: str :ivar location: The location of the new virtual machine or environment. :vartype location: str :ivar tags: The tags of the resource. :vartype tags: dict[str, str] - :ivar bulk_creation_parameters: The number of virtual machine instances to create. - :vartype bulk_creation_parameters: ~azure.mgmt.devtestlabs.models.BulkCreationParameters :ivar notes: The notes of the virtual machine. :vartype notes: str :ivar owner_object_id: The object identifier of the owner of the virtual machine. :vartype owner_object_id: str :ivar owner_user_principal_name: The user principal name of the virtual machine owner. :vartype owner_user_principal_name: str - :ivar created_date: The creation date of the virtual machine. - :vartype created_date: ~datetime.datetime + :ivar created_by_user_id: The object identifier of the creator of the virtual machine. + :vartype created_by_user_id: str + :ivar created_by_user: The email address of creator of the virtual machine. + :vartype created_by_user: str + :ivar created_date_properties_created_date: The creation date of the virtual machine. + :vartype created_date_properties_created_date: ~datetime.datetime + :ivar compute_id: The resource identifier (Microsoft.Compute) of the virtual machine. + :vartype compute_id: str :ivar custom_image_id: The custom image identifier of the virtual machine. :vartype custom_image_id: str + :ivar gallery_image_version_id: The shared gallery image version resource identifier of the + virtual machine. + :vartype gallery_image_version_id: str + :ivar shared_image_id: The shared image resource identifier of the virtual machine. + :vartype shared_image_id: str + :ivar shared_image_version: The shared image version for the specified shared image Id. Will + use latest if not specified. + :vartype shared_image_version: str + :ivar os_type_properties_os_type: The OS type of the virtual machine. + :vartype os_type_properties_os_type: str :ivar size: The size of the virtual machine. :vartype size: str :ivar user_name: The user name of the virtual machine. @@ -3585,6 +6570,8 @@ class LabVirtualMachineCreationParameter(_serialization.Model): # pylint: disab :ivar is_authentication_with_ssh_key: Indicates whether this virtual machine uses an SSH key for authentication. :vartype is_authentication_with_ssh_key: bool + :ivar fqdn: The fully-qualified domain name of the virtual machine. + :vartype fqdn: str :ivar lab_subnet_name: The lab subnet name of the virtual machine. :vartype lab_subnet_name: str :ivar lab_virtual_network_id: The lab virtual network identifier of the virtual machine. @@ -3594,19 +6581,23 @@ class LabVirtualMachineCreationParameter(_serialization.Model): # pylint: disab :vartype disallow_public_ip_address: bool :ivar artifacts: The artifacts to be installed on the virtual machine. :vartype artifacts: list[~azure.mgmt.devtestlabs.models.ArtifactInstallProperties] - :ivar gallery_image_reference: The Microsoft Azure Marketplace image reference of the virtual - machine. - :vartype gallery_image_reference: ~azure.mgmt.devtestlabs.models.GalleryImageReference :ivar plan_id: The id of the plan associated with the virtual machine image. :vartype plan_id: str - :ivar network_interface: The network interface properties. - :vartype network_interface: ~azure.mgmt.devtestlabs.models.NetworkInterfaceProperties + :ivar os_disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can + be used to overwrite the size of the disk in a virtual machine image. + :vartype os_disk_size_gb: int :ivar expiration_date: The expiration date for VM. :vartype expiration_date: ~datetime.datetime :ivar allow_claim: Indicates whether another user can take ownership of the virtual machine. :vartype allow_claim: bool - :ivar storage_type: Storage type to use for virtual machine (i.e. Standard, Premium). - :vartype storage_type: str + :ivar storage_type: Storage type to use for virtual machine (i.e. Standard, Premium, + StandardSSD). Known values are: "Standard", "Premium", and "StandardSSD". + :vartype storage_type: str or ~azure.mgmt.devtestlabs.models.StorageType + :ivar virtual_machine_creation_source: Tells source of creation of lab virtual machine. Output + property only. Known values are: "FromCustomImage", "FromGalleryImage", and + "FromSharedGalleryImage". + :vartype virtual_machine_creation_source: str or + ~azure.mgmt.devtestlabs.models.VirtualMachineCreationSource :ivar environment_id: The resource ID of the environment that contains this virtual machine, if any. :vartype environment_id: str @@ -3615,36 +6606,619 @@ class LabVirtualMachineCreationParameter(_serialization.Model): # pylint: disab :vartype data_disk_parameters: list[~azure.mgmt.devtestlabs.models.DataDiskProperties] :ivar schedule_parameters: Virtual Machine schedules to be created. :vartype schedule_parameters: list[~azure.mgmt.devtestlabs.models.ScheduleCreationParameter] + :ivar last_known_power_state: Last known compute power state captured in DTL. + :vartype last_known_power_state: str + :ivar can_apply_artifacts: Flag to determine if apply artifacts can be triggered at the time of + fetching the document. + :vartype can_apply_artifacts: bool + :ivar provisioning_state_properties_provisioning_state: The provisioning status of the + resource. + :vartype provisioning_state_properties_provisioning_state: str + :ivar unique_identifier_properties_unique_identifier: The unique immutable identifier of a + resource (Guid). + :vartype unique_identifier_properties_unique_identifier: str + :ivar security_profile: Option to apply more security protection for VMs. + :vartype security_profile: ~azure.mgmt.devtestlabs.models.SecurityProfile + :ivar id_properties_applicable_schedule_id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_id: str + :ivar name_properties_applicable_schedule_name: The name of the resource. + :vartype name_properties_applicable_schedule_name: str + :ivar type_properties_applicable_schedule_type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_type: str + :ivar tags_properties_applicable_schedule_tags: Resource tags. + :vartype tags_properties_applicable_schedule_tags: dict[str, str] + :ivar location_properties_applicable_schedule_location: The geo-location where the resource + lives. + :vartype location_properties_applicable_schedule_location: str + :ivar system_data_properties_applicable_schedule_system_data: The system metadata relating to + this resource. + :vartype system_data_properties_applicable_schedule_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar id_properties_applicable_schedule_properties_lab_vms_startup_id: Fully qualified resource + ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_properties_lab_vms_startup_id: str + :ivar name_properties_applicable_schedule_properties_lab_vms_startup_name: The name of the + resource. + :vartype name_properties_applicable_schedule_properties_lab_vms_startup_name: str + :ivar type_properties_applicable_schedule_properties_lab_vms_startup_type: The type of the + resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_properties_lab_vms_startup_type: str + :ivar tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Resource tags. + :vartype tags_properties_applicable_schedule_properties_lab_vms_startup_tags: dict[str, str] + :ivar location_properties_applicable_schedule_properties_lab_vms_startup_location: The + geo-location where the resource lives. + :vartype location_properties_applicable_schedule_properties_lab_vms_startup_location: str + :ivar system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data: The + system metadata relating to this resource. + :vartype system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: The + status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: + The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: str + :ivar + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :vartype + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + str + :ivar + created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date: + The creation date of the schedule. + :vartype + created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date: + ~datetime.datetime + :ivar + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + The resource ID to which the schedule belongs. + :vartype + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + str + :ivar + provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state: + The provisioning status of the resource. + :vartype + provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state: + str + :ivar + unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier: + The unique immutable identifier of a resource (Guid). + :vartype + unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier: + str + :ivar + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :ivar + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :vartype + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :ivar + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :vartype + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + int + :ivar + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + The time of day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + str + :ivar + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + list[str] + :ivar + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + str + :ivar id_properties_applicable_schedule_properties_lab_vms_shutdown_id: Fully qualified + resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_properties_lab_vms_shutdown_id: str + :ivar name_properties_applicable_schedule_properties_lab_vms_shutdown_name: The name of the + resource. + :vartype name_properties_applicable_schedule_properties_lab_vms_shutdown_name: str + :ivar type_properties_applicable_schedule_properties_lab_vms_shutdown_type: The type of the + resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_properties_lab_vms_shutdown_type: str + :ivar tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Resource tags. + :vartype tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: dict[str, str] + :ivar location_properties_applicable_schedule_properties_lab_vms_shutdown_location: The + geo-location where the resource lives. + :vartype location_properties_applicable_schedule_properties_lab_vms_shutdown_location: str + :ivar system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data: The + system metadata relating to this resource. + :vartype system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: The + status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: str + :ivar + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :vartype + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + str + :ivar + created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date: + The creation date of the schedule. + :vartype + created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date: + ~datetime.datetime + :ivar + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + The resource ID to which the schedule belongs. + :vartype + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + str + :ivar + provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state: + The provisioning status of the resource. + :vartype + provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state: + str + :ivar + unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier: + The unique immutable identifier of a resource (Guid). + :vartype + unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier: + str + :ivar + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :ivar + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :vartype + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :ivar + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :vartype + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + int + :ivar + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + The time of day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + str + :ivar + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :ivar + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + str + :ivar virtual_network_id: The resource ID of the virtual network. + :vartype virtual_network_id: str + :ivar subnet_id: The resource ID of the sub net. + :vartype subnet_id: str + :ivar public_ip_address_id: The resource ID of the public IP address. + :vartype public_ip_address_id: str + :ivar public_ip_address: The public IP address. + :vartype public_ip_address: str + :ivar private_ip_address: The private IP address. + :vartype private_ip_address: str + :ivar dns_name: The DNS name. + :vartype dns_name: str + :ivar rdp_authority: The RdpAuthority property is a server DNS host name or IP address followed + by the service port number for RDP (Remote Desktop Protocol). + :vartype rdp_authority: str + :ivar ssh_authority: The SshAuthority property is a server DNS host name or IP address followed + by the service port number for SSH. + :vartype ssh_authority: str + :ivar inbound_nat_rules: The incoming NAT rules. + :vartype inbound_nat_rules: list[~azure.mgmt.devtestlabs.models.InboundNatRule] + :ivar statuses: Gets the statuses of the virtual machine. + :vartype statuses: list[~azure.mgmt.devtestlabs.models.ComputeVmInstanceViewStatus] + :ivar os_type_properties_compute_vm_os_type: Gets the OS type of the virtual machine. + :vartype os_type_properties_compute_vm_os_type: str + :ivar vm_size: Gets the size of the virtual machine. + :vartype vm_size: str + :ivar network_interface_id: Gets the network interface ID of the virtual machine. + :vartype network_interface_id: str + :ivar os_disk_id: Gets OS disk blob uri for the virtual machine. + :vartype os_disk_id: str + :ivar data_disk_ids: Gets data disks blob uri for the virtual machine. + :vartype data_disk_ids: list[str] + :ivar data_disks: Gets all data disks attached to the virtual machine. + :vartype data_disks: list[~azure.mgmt.devtestlabs.models.ComputeDataDisk] + :ivar offer: The offer of the gallery image. + :vartype offer: str + :ivar publisher: The publisher of the gallery image. + :vartype publisher: str + :ivar sku: The SKU of the gallery image. + :vartype sku: str + :ivar os_type_properties_gallery_image_reference_os_type: The OS type of the gallery image. + :vartype os_type_properties_gallery_image_reference_os_type: str + :ivar version: The version of the gallery image. + :vartype version: str + :ivar deployment_status: The deployment status of the artifact. + :vartype deployment_status: str + :ivar artifacts_applied: The total count of the artifacts that were successfully applied. + :vartype artifacts_applied: int + :ivar total_artifacts: The total count of the artifacts that were tentatively applied. + :vartype total_artifacts: int + :ivar instance_count: The number of virtual machine instances to create. + :vartype instance_count: int """ + _validation = { + "created_by_user_id": {"readonly": True}, + "created_by_user": {"readonly": True}, + "compute_id": {"readonly": True}, + "os_type_properties_os_type": {"readonly": True}, + "fqdn": {"readonly": True}, + "virtual_machine_creation_source": {"readonly": True}, + "last_known_power_state": {"readonly": True}, + "can_apply_artifacts": {"readonly": True}, + "provisioning_state_properties_provisioning_state": {"readonly": True}, + "unique_identifier_properties_unique_identifier": {"readonly": True}, + "id_properties_applicable_schedule_id": {"readonly": True}, + "name_properties_applicable_schedule_name": {"readonly": True}, + "type_properties_applicable_schedule_type": {"readonly": True}, + "system_data_properties_applicable_schedule_system_data": {"readonly": True}, + "id_properties_applicable_schedule_properties_lab_vms_startup_id": {"readonly": True}, + "name_properties_applicable_schedule_properties_lab_vms_startup_name": {"readonly": True}, + "type_properties_applicable_schedule_properties_lab_vms_startup_type": {"readonly": True}, + "system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data": {"readonly": True}, + "created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date": { + "readonly": True + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state": { + "readonly": True + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier": { + "readonly": True + }, + "id_properties_applicable_schedule_properties_lab_vms_shutdown_id": {"readonly": True}, + "name_properties_applicable_schedule_properties_lab_vms_shutdown_name": {"readonly": True}, + "type_properties_applicable_schedule_properties_lab_vms_shutdown_type": {"readonly": True}, + "system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data": {"readonly": True}, + "created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date": { + "readonly": True + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state": { + "readonly": True + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier": { + "readonly": True + }, + } + _attribute_map = { "name": {"key": "name", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "bulk_creation_parameters": {"key": "properties.bulkCreationParameters", "type": "BulkCreationParameters"}, "notes": {"key": "properties.notes", "type": "str"}, "owner_object_id": {"key": "properties.ownerObjectId", "type": "str"}, "owner_user_principal_name": {"key": "properties.ownerUserPrincipalName", "type": "str"}, - "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, + "created_by_user_id": {"key": "properties.createdByUserId", "type": "str"}, + "created_by_user": {"key": "properties.createdByUser", "type": "str"}, + "created_date_properties_created_date": {"key": "properties.createdDate", "type": "iso-8601"}, + "compute_id": {"key": "properties.computeId", "type": "str"}, "custom_image_id": {"key": "properties.customImageId", "type": "str"}, + "gallery_image_version_id": {"key": "properties.galleryImageVersionId", "type": "str"}, + "shared_image_id": {"key": "properties.sharedImageId", "type": "str"}, + "shared_image_version": {"key": "properties.sharedImageVersion", "type": "str"}, + "os_type_properties_os_type": {"key": "properties.osType", "type": "str"}, "size": {"key": "properties.size", "type": "str"}, "user_name": {"key": "properties.userName", "type": "str"}, "password": {"key": "properties.password", "type": "str"}, "ssh_key": {"key": "properties.sshKey", "type": "str"}, "is_authentication_with_ssh_key": {"key": "properties.isAuthenticationWithSshKey", "type": "bool"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, "lab_subnet_name": {"key": "properties.labSubnetName", "type": "str"}, "lab_virtual_network_id": {"key": "properties.labVirtualNetworkId", "type": "str"}, "disallow_public_ip_address": {"key": "properties.disallowPublicIpAddress", "type": "bool"}, "artifacts": {"key": "properties.artifacts", "type": "[ArtifactInstallProperties]"}, - "gallery_image_reference": {"key": "properties.galleryImageReference", "type": "GalleryImageReference"}, "plan_id": {"key": "properties.planId", "type": "str"}, - "network_interface": {"key": "properties.networkInterface", "type": "NetworkInterfaceProperties"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGb", "type": "int"}, "expiration_date": {"key": "properties.expirationDate", "type": "iso-8601"}, "allow_claim": {"key": "properties.allowClaim", "type": "bool"}, "storage_type": {"key": "properties.storageType", "type": "str"}, + "virtual_machine_creation_source": {"key": "properties.virtualMachineCreationSource", "type": "str"}, "environment_id": {"key": "properties.environmentId", "type": "str"}, "data_disk_parameters": {"key": "properties.dataDiskParameters", "type": "[DataDiskProperties]"}, "schedule_parameters": {"key": "properties.scheduleParameters", "type": "[ScheduleCreationParameter]"}, + "last_known_power_state": {"key": "properties.lastKnownPowerState", "type": "str"}, + "can_apply_artifacts": {"key": "properties.canApplyArtifacts", "type": "bool"}, + "provisioning_state_properties_provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier_properties_unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "security_profile": {"key": "properties.securityProfile", "type": "SecurityProfile"}, + "id_properties_applicable_schedule_id": {"key": "properties.applicableSchedule.id", "type": "str"}, + "name_properties_applicable_schedule_name": {"key": "properties.applicableSchedule.name", "type": "str"}, + "type_properties_applicable_schedule_type": {"key": "properties.applicableSchedule.type", "type": "str"}, + "tags_properties_applicable_schedule_tags": {"key": "properties.applicableSchedule.tags", "type": "{str}"}, + "location_properties_applicable_schedule_location": { + "key": "properties.applicableSchedule.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_system_data": { + "key": "properties.applicableSchedule.systemData", + "type": "SystemData", + }, + "id_properties_applicable_schedule_properties_lab_vms_startup_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.id", + "type": "str", + }, + "name_properties_applicable_schedule_properties_lab_vms_startup_name": { + "key": "properties.applicableSchedule.properties.labVmsStartup.name", + "type": "str", + }, + "type_properties_applicable_schedule_properties_lab_vms_startup_type": { + "key": "properties.applicableSchedule.properties.labVmsStartup.type", + "type": "str", + }, + "tags_properties_applicable_schedule_properties_lab_vms_startup_tags": { + "key": "properties.applicableSchedule.properties.labVmsStartup.tags", + "type": "{str}", + }, + "location_properties_applicable_schedule_properties_lab_vms_startup_location": { + "key": "properties.applicableSchedule.properties.labVmsStartup.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data": { + "key": "properties.applicableSchedule.properties.labVmsStartup.systemData", + "type": "SystemData", + }, + "status_properties_applicable_schedule_properties_lab_vms_startup_properties_status": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.status", + "type": "str", + }, + "task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.weeklyRecurrence.time", + "type": "str", + }, + "id_properties_applicable_schedule_properties_lab_vms_shutdown_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.id", + "type": "str", + }, + "name_properties_applicable_schedule_properties_lab_vms_shutdown_name": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.name", + "type": "str", + }, + "type_properties_applicable_schedule_properties_lab_vms_shutdown_type": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.type", + "type": "str", + }, + "tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.tags", + "type": "{str}", + }, + "location_properties_applicable_schedule_properties_lab_vms_shutdown_location": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.systemData", + "type": "SystemData", + }, + "status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.status", + "type": "str", + }, + "task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.weeklyRecurrence.time", + "type": "str", + }, + "virtual_network_id": {"key": "properties.networkInterface.virtualNetworkId", "type": "str"}, + "subnet_id": {"key": "properties.networkInterface.subnetId", "type": "str"}, + "public_ip_address_id": {"key": "properties.networkInterface.publicIpAddressId", "type": "str"}, + "public_ip_address": {"key": "properties.networkInterface.publicIpAddress", "type": "str"}, + "private_ip_address": {"key": "properties.networkInterface.privateIpAddress", "type": "str"}, + "dns_name": {"key": "properties.networkInterface.dnsName", "type": "str"}, + "rdp_authority": {"key": "properties.networkInterface.rdpAuthority", "type": "str"}, + "ssh_authority": {"key": "properties.networkInterface.sshAuthority", "type": "str"}, + "inbound_nat_rules": { + "key": "properties.networkInterface.sharedPublicIpAddressConfiguration.inboundNatRules", + "type": "[InboundNatRule]", + }, + "statuses": {"key": "properties.computeVm.statuses", "type": "[ComputeVmInstanceViewStatus]"}, + "os_type_properties_compute_vm_os_type": {"key": "properties.computeVm.osType", "type": "str"}, + "vm_size": {"key": "properties.computeVm.vmSize", "type": "str"}, + "network_interface_id": {"key": "properties.computeVm.networkInterfaceId", "type": "str"}, + "os_disk_id": {"key": "properties.computeVm.osDiskId", "type": "str"}, + "data_disk_ids": {"key": "properties.computeVm.dataDiskIds", "type": "[str]"}, + "data_disks": {"key": "properties.computeVm.dataDisks", "type": "[ComputeDataDisk]"}, + "offer": {"key": "properties.galleryImageReference.offer", "type": "str"}, + "publisher": {"key": "properties.galleryImageReference.publisher", "type": "str"}, + "sku": {"key": "properties.galleryImageReference.sku", "type": "str"}, + "os_type_properties_gallery_image_reference_os_type": { + "key": "properties.galleryImageReference.osType", + "type": "str", + }, + "version": {"key": "properties.galleryImageReference.version", "type": "str"}, + "deployment_status": {"key": "properties.artifactDeploymentStatus.deploymentStatus", "type": "str"}, + "artifacts_applied": {"key": "properties.artifactDeploymentStatus.artifactsApplied", "type": "int"}, + "total_artifacts": {"key": "properties.artifactDeploymentStatus.totalArtifacts", "type": "int"}, + "instance_count": {"key": "properties.bulkCreationParameters.instanceCount", "type": "int"}, } def __init__( # pylint: disable=too-many-locals @@ -3653,12 +7227,14 @@ def __init__( # pylint: disable=too-many-locals name: Optional[str] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - bulk_creation_parameters: Optional["_models.BulkCreationParameters"] = None, notes: Optional[str] = None, owner_object_id: str = "dynamicValue", owner_user_principal_name: Optional[str] = None, - created_date: Optional[datetime.datetime] = None, + created_date_properties_created_date: Optional[datetime.datetime] = None, custom_image_id: Optional[str] = None, + gallery_image_version_id: Optional[str] = None, + shared_image_id: Optional[str] = None, + shared_image_version: Optional[str] = None, size: Optional[str] = None, user_name: Optional[str] = None, password: Optional[str] = None, @@ -3668,17 +7244,122 @@ def __init__( # pylint: disable=too-many-locals lab_virtual_network_id: Optional[str] = None, disallow_public_ip_address: bool = False, artifacts: Optional[List["_models.ArtifactInstallProperties"]] = None, - gallery_image_reference: Optional["_models.GalleryImageReference"] = None, plan_id: Optional[str] = None, - network_interface: Optional["_models.NetworkInterfaceProperties"] = None, + os_disk_size_gb: Optional[int] = None, expiration_date: Optional[datetime.datetime] = None, allow_claim: bool = False, - storage_type: str = "labStorageType", + storage_type: Optional[Union[str, "_models.StorageType"]] = None, environment_id: Optional[str] = None, data_disk_parameters: Optional[List["_models.DataDiskProperties"]] = None, schedule_parameters: Optional[List["_models.ScheduleCreationParameter"]] = None, - **kwargs - ): + security_profile: Optional["_models.SecurityProfile"] = None, + tags_properties_applicable_schedule_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_location: Optional[str] = None, + tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_properties_lab_vms_startup_location: Optional[str] = None, + status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: Optional[str] = None, + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: Optional[ + str + ] = None, + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: Optional[ + str + ] = None, + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: Optional[ + str + ] = None, + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: Optional[ + int + ] = None, + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: Optional[ + str + ] = None, + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: Optional[ + List[str] + ] = None, + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: Optional[ + str + ] = None, + tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_properties_lab_vms_shutdown_location: Optional[str] = None, + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: Optional[str] = None, + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: Optional[ + str + ] = None, + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: Optional[ + str + ] = None, + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: Optional[ + str + ] = None, + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: Optional[ + int + ] = None, + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: Optional[ + str + ] = None, + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: Optional[ + List[str] + ] = None, + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: Optional[ + str + ] = None, + virtual_network_id: Optional[str] = None, + subnet_id: Optional[str] = None, + public_ip_address_id: Optional[str] = None, + public_ip_address: Optional[str] = None, + private_ip_address: Optional[str] = None, + dns_name: Optional[str] = None, + rdp_authority: Optional[str] = None, + ssh_authority: Optional[str] = None, + inbound_nat_rules: Optional[List["_models.InboundNatRule"]] = None, + statuses: Optional[List["_models.ComputeVmInstanceViewStatus"]] = None, + os_type_properties_compute_vm_os_type: Optional[str] = None, + vm_size: Optional[str] = None, + network_interface_id: Optional[str] = None, + os_disk_id: Optional[str] = None, + data_disk_ids: Optional[List[str]] = None, + data_disks: Optional[List["_models.ComputeDataDisk"]] = None, + offer: Optional[str] = None, + publisher: Optional[str] = None, + sku: Optional[str] = None, + os_type_properties_gallery_image_reference_os_type: Optional[str] = None, + version: Optional[str] = None, + deployment_status: Optional[str] = None, + artifacts_applied: Optional[int] = None, + total_artifacts: Optional[int] = None, + instance_count: Optional[int] = None, + **kwargs: Any + ) -> None: """ :keyword name: The name of the virtual machine or environment. :paramtype name: str @@ -3686,18 +7367,24 @@ def __init__( # pylint: disable=too-many-locals :paramtype location: str :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] - :keyword bulk_creation_parameters: The number of virtual machine instances to create. - :paramtype bulk_creation_parameters: ~azure.mgmt.devtestlabs.models.BulkCreationParameters :keyword notes: The notes of the virtual machine. :paramtype notes: str :keyword owner_object_id: The object identifier of the owner of the virtual machine. :paramtype owner_object_id: str :keyword owner_user_principal_name: The user principal name of the virtual machine owner. :paramtype owner_user_principal_name: str - :keyword created_date: The creation date of the virtual machine. - :paramtype created_date: ~datetime.datetime + :keyword created_date_properties_created_date: The creation date of the virtual machine. + :paramtype created_date_properties_created_date: ~datetime.datetime :keyword custom_image_id: The custom image identifier of the virtual machine. :paramtype custom_image_id: str + :keyword gallery_image_version_id: The shared gallery image version resource identifier of the + virtual machine. + :paramtype gallery_image_version_id: str + :keyword shared_image_id: The shared image resource identifier of the virtual machine. + :paramtype shared_image_id: str + :keyword shared_image_version: The shared image version for the specified shared image Id. Will + use latest if not specified. + :paramtype shared_image_version: str :keyword size: The size of the virtual machine. :paramtype size: str :keyword user_name: The user name of the virtual machine. @@ -3718,19 +7405,18 @@ def __init__( # pylint: disable=too-many-locals :paramtype disallow_public_ip_address: bool :keyword artifacts: The artifacts to be installed on the virtual machine. :paramtype artifacts: list[~azure.mgmt.devtestlabs.models.ArtifactInstallProperties] - :keyword gallery_image_reference: The Microsoft Azure Marketplace image reference of the - virtual machine. - :paramtype gallery_image_reference: ~azure.mgmt.devtestlabs.models.GalleryImageReference :keyword plan_id: The id of the plan associated with the virtual machine image. :paramtype plan_id: str - :keyword network_interface: The network interface properties. - :paramtype network_interface: ~azure.mgmt.devtestlabs.models.NetworkInterfaceProperties + :keyword os_disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element + can be used to overwrite the size of the disk in a virtual machine image. + :paramtype os_disk_size_gb: int :keyword expiration_date: The expiration date for VM. :paramtype expiration_date: ~datetime.datetime :keyword allow_claim: Indicates whether another user can take ownership of the virtual machine. :paramtype allow_claim: bool - :keyword storage_type: Storage type to use for virtual machine (i.e. Standard, Premium). - :paramtype storage_type: str + :keyword storage_type: Storage type to use for virtual machine (i.e. Standard, Premium, + StandardSSD). Known values are: "Standard", "Premium", and "StandardSSD". + :paramtype storage_type: str or ~azure.mgmt.devtestlabs.models.StorageType :keyword environment_id: The resource ID of the environment that contains this virtual machine, if any. :paramtype environment_id: str @@ -3739,77 +7425,629 @@ def __init__( # pylint: disable=too-many-locals :paramtype data_disk_parameters: list[~azure.mgmt.devtestlabs.models.DataDiskProperties] :keyword schedule_parameters: Virtual Machine schedules to be created. :paramtype schedule_parameters: list[~azure.mgmt.devtestlabs.models.ScheduleCreationParameter] + :keyword security_profile: Option to apply more security protection for VMs. + :paramtype security_profile: ~azure.mgmt.devtestlabs.models.SecurityProfile + :keyword tags_properties_applicable_schedule_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_tags: dict[str, str] + :keyword location_properties_applicable_schedule_location: The geo-location where the resource + lives. + :paramtype location_properties_applicable_schedule_location: str + :keyword tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_properties_lab_vms_startup_tags: dict[str, str] + :keyword location_properties_applicable_schedule_properties_lab_vms_startup_location: The + geo-location where the resource lives. + :paramtype location_properties_applicable_schedule_properties_lab_vms_startup_location: str + :keyword status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :paramtype status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: str + :keyword + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :paramtype + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + str + :keyword + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + The resource ID to which the schedule belongs. + :paramtype + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + str + :keyword + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :keyword + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :keyword + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :paramtype + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + int + :keyword + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + The time of day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + str + :keyword + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + list[str] + :keyword + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + str + :keyword tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: dict[str, str] + :keyword location_properties_applicable_schedule_properties_lab_vms_shutdown_location: The + geo-location where the resource lives. + :paramtype location_properties_applicable_schedule_properties_lab_vms_shutdown_location: str + :keyword status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :paramtype status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: str + :keyword + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :paramtype + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + str + :keyword + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + The resource ID to which the schedule belongs. + :paramtype + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + str + :keyword + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :keyword + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :keyword + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :paramtype + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + int + :keyword + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + The time of day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + str + :keyword + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :keyword + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + str + :keyword virtual_network_id: The resource ID of the virtual network. + :paramtype virtual_network_id: str + :keyword subnet_id: The resource ID of the sub net. + :paramtype subnet_id: str + :keyword public_ip_address_id: The resource ID of the public IP address. + :paramtype public_ip_address_id: str + :keyword public_ip_address: The public IP address. + :paramtype public_ip_address: str + :keyword private_ip_address: The private IP address. + :paramtype private_ip_address: str + :keyword dns_name: The DNS name. + :paramtype dns_name: str + :keyword rdp_authority: The RdpAuthority property is a server DNS host name or IP address + followed by the service port number for RDP (Remote Desktop Protocol). + :paramtype rdp_authority: str + :keyword ssh_authority: The SshAuthority property is a server DNS host name or IP address + followed by the service port number for SSH. + :paramtype ssh_authority: str + :keyword inbound_nat_rules: The incoming NAT rules. + :paramtype inbound_nat_rules: list[~azure.mgmt.devtestlabs.models.InboundNatRule] + :keyword statuses: Gets the statuses of the virtual machine. + :paramtype statuses: list[~azure.mgmt.devtestlabs.models.ComputeVmInstanceViewStatus] + :keyword os_type_properties_compute_vm_os_type: Gets the OS type of the virtual machine. + :paramtype os_type_properties_compute_vm_os_type: str + :keyword vm_size: Gets the size of the virtual machine. + :paramtype vm_size: str + :keyword network_interface_id: Gets the network interface ID of the virtual machine. + :paramtype network_interface_id: str + :keyword os_disk_id: Gets OS disk blob uri for the virtual machine. + :paramtype os_disk_id: str + :keyword data_disk_ids: Gets data disks blob uri for the virtual machine. + :paramtype data_disk_ids: list[str] + :keyword data_disks: Gets all data disks attached to the virtual machine. + :paramtype data_disks: list[~azure.mgmt.devtestlabs.models.ComputeDataDisk] + :keyword offer: The offer of the gallery image. + :paramtype offer: str + :keyword publisher: The publisher of the gallery image. + :paramtype publisher: str + :keyword sku: The SKU of the gallery image. + :paramtype sku: str + :keyword os_type_properties_gallery_image_reference_os_type: The OS type of the gallery image. + :paramtype os_type_properties_gallery_image_reference_os_type: str + :keyword version: The version of the gallery image. + :paramtype version: str + :keyword deployment_status: The deployment status of the artifact. + :paramtype deployment_status: str + :keyword artifacts_applied: The total count of the artifacts that were successfully applied. + :paramtype artifacts_applied: int + :keyword total_artifacts: The total count of the artifacts that were tentatively applied. + :paramtype total_artifacts: int + :keyword instance_count: The number of virtual machine instances to create. + :paramtype instance_count: int """ super().__init__(**kwargs) self.name = name self.location = location self.tags = tags - self.bulk_creation_parameters = bulk_creation_parameters self.notes = notes self.owner_object_id = owner_object_id self.owner_user_principal_name = owner_user_principal_name - self.created_date = created_date + self.created_by_user_id = None + self.created_by_user = None + self.created_date_properties_created_date = created_date_properties_created_date + self.compute_id = None self.custom_image_id = custom_image_id + self.gallery_image_version_id = gallery_image_version_id + self.shared_image_id = shared_image_id + self.shared_image_version = shared_image_version + self.os_type_properties_os_type = None self.size = size self.user_name = user_name self.password = password self.ssh_key = ssh_key self.is_authentication_with_ssh_key = is_authentication_with_ssh_key + self.fqdn = None self.lab_subnet_name = lab_subnet_name self.lab_virtual_network_id = lab_virtual_network_id self.disallow_public_ip_address = disallow_public_ip_address self.artifacts = artifacts - self.gallery_image_reference = gallery_image_reference self.plan_id = plan_id - self.network_interface = network_interface + self.os_disk_size_gb = os_disk_size_gb self.expiration_date = expiration_date self.allow_claim = allow_claim self.storage_type = storage_type + self.virtual_machine_creation_source = None self.environment_id = environment_id self.data_disk_parameters = data_disk_parameters self.schedule_parameters = schedule_parameters + self.last_known_power_state = None + self.can_apply_artifacts = None + self.provisioning_state_properties_provisioning_state = None + self.unique_identifier_properties_unique_identifier = None + self.security_profile = security_profile + self.id_properties_applicable_schedule_id = None + self.name_properties_applicable_schedule_name = None + self.type_properties_applicable_schedule_type = None + self.tags_properties_applicable_schedule_tags = tags_properties_applicable_schedule_tags + self.location_properties_applicable_schedule_location = location_properties_applicable_schedule_location + self.system_data_properties_applicable_schedule_system_data = None + self.id_properties_applicable_schedule_properties_lab_vms_startup_id = None + self.name_properties_applicable_schedule_properties_lab_vms_startup_name = None + self.type_properties_applicable_schedule_properties_lab_vms_startup_type = None + self.tags_properties_applicable_schedule_properties_lab_vms_startup_tags = ( + tags_properties_applicable_schedule_properties_lab_vms_startup_tags + ) + self.location_properties_applicable_schedule_properties_lab_vms_startup_location = ( + location_properties_applicable_schedule_properties_lab_vms_startup_location + ) + self.system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data = None + self.status_properties_applicable_schedule_properties_lab_vms_startup_properties_status = ( + status_properties_applicable_schedule_properties_lab_vms_startup_properties_status + ) + self.task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type = ( + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type + ) + self.time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id = ( + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id + ) + self.created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date = None + self.target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id = ( + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id + ) + self.provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state = ( + None + ) + self.unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier = ( + None + ) + self.status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status = ( + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status + ) + self.time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes = time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes + self.webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url = webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url + self.email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient = email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient + self.notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale = notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale + self.minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute = ( + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute + ) + self.time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time + ) + self.weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays = ( + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays + ) + self.time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time + ) + self.id_properties_applicable_schedule_properties_lab_vms_shutdown_id = None + self.name_properties_applicable_schedule_properties_lab_vms_shutdown_name = None + self.type_properties_applicable_schedule_properties_lab_vms_shutdown_type = None + self.tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags = ( + tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags + ) + self.location_properties_applicable_schedule_properties_lab_vms_shutdown_location = ( + location_properties_applicable_schedule_properties_lab_vms_shutdown_location + ) + self.system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data = None + self.status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status = ( + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status + ) + self.task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type = ( + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type + ) + self.time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id = ( + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id + ) + self.created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date = None + self.target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id = ( + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id + ) + self.provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state = ( + None + ) + self.unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier = ( + None + ) + self.status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status = ( + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status + ) + self.time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes = time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes + self.webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url = webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url + self.email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient = email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient + self.notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale = notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale + self.minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute = ( + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute + ) + self.time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time + ) + self.weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays = ( + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays + ) + self.time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time + ) + self.virtual_network_id = virtual_network_id + self.subnet_id = subnet_id + self.public_ip_address_id = public_ip_address_id + self.public_ip_address = public_ip_address + self.private_ip_address = private_ip_address + self.dns_name = dns_name + self.rdp_authority = rdp_authority + self.ssh_authority = ssh_authority + self.inbound_nat_rules = inbound_nat_rules + self.statuses = statuses + self.os_type_properties_compute_vm_os_type = os_type_properties_compute_vm_os_type + self.vm_size = vm_size + self.network_interface_id = network_interface_id + self.os_disk_id = os_disk_id + self.data_disk_ids = data_disk_ids + self.data_disks = data_disks + self.offer = offer + self.publisher = publisher + self.sku = sku + self.os_type_properties_gallery_image_reference_os_type = os_type_properties_gallery_image_reference_os_type + self.version = version + self.deployment_status = deployment_status + self.artifacts_applied = artifacts_applied + self.total_artifacts = total_artifacts + self.instance_count = instance_count + + +class LabVirtualMachineFragment(UpdateResource): + """Patch. + + :ivar tags: The tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + """ + super().__init__(tags=tags, identity=identity, **kwargs) + + +class LabVirtualMachineList(_serialization.Model): + """Contains a list of virtualMachines and their properties. + + :ivar value: List of virtualMachines and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.LabVirtualMachine] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[LabVirtualMachine]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.LabVirtualMachine"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of virtualMachines and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.LabVirtualMachine] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NotificationChannel(Resource): # pylint: disable=too-many-instance-attributes + """A notification. + + 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar web_hook_url: The webhook URL to send notifications to. + :vartype web_hook_url: str + :ivar email_recipient: The email recipient to send notifications to (can be a list of + semi-colon separated email addresses). + :vartype email_recipient: str + :ivar notification_locale: The locale to use when sending a notification (fallback for + unsupported languages is EN). + :vartype notification_locale: str + :ivar description: Description of notification. + :vartype description: str + :ivar events: The list of event for which this notification is enabled. + :vartype events: list[~azure.mgmt.devtestlabs.models.Event] + :ivar created_date: The creation date of the notification channel. + :vartype created_date: ~datetime.datetime + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :ivar unique_identifier: The unique immutable identifier of a resource (Guid). + :vartype unique_identifier: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "created_date": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "unique_identifier": {"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"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "web_hook_url": {"key": "properties.webHookUrl", "type": "str"}, + "email_recipient": {"key": "properties.emailRecipient", "type": "str"}, + "notification_locale": {"key": "properties.notificationLocale", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "events": {"key": "properties.events", "type": "[Event]"}, + "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + web_hook_url: Optional[str] = None, + email_recipient: Optional[str] = None, + notification_locale: Optional[str] = None, + description: Optional[str] = None, + events: Optional[List["_models.Event"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword web_hook_url: The webhook URL to send notifications to. + :paramtype web_hook_url: str + :keyword email_recipient: The email recipient to send notifications to (can be a list of + semi-colon separated email addresses). + :paramtype email_recipient: str + :keyword notification_locale: The locale to use when sending a notification (fallback for + unsupported languages is EN). + :paramtype notification_locale: str + :keyword description: Description of notification. + :paramtype description: str + :keyword events: The list of event for which this notification is enabled. + :paramtype events: list[~azure.mgmt.devtestlabs.models.Event] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.web_hook_url = web_hook_url + self.email_recipient = email_recipient + self.notification_locale = notification_locale + self.description = description + self.events = events + self.created_date = None + self.provisioning_state = None + self.unique_identifier = None -class LabVirtualMachineFragment(UpdateResource): - """A virtual machine. +class NotificationChannelFragment(UpdateResource): + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) -class LabVirtualMachineList(_serialization.Model): - """The response of a list operation. +class NotificationChannelList(_serialization.Model): + """Contains a list of notificationChannels and their properties. - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.LabVirtualMachine] - :ivar next_link: Link for next set of results. + :ivar value: List of notificationChannels and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.NotificationChannel] + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[LabVirtualMachine]"}, + "value": {"key": "value", "type": "[NotificationChannel]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.LabVirtualMachine"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.NotificationChannel"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.LabVirtualMachine] - :keyword next_link: Link for next set of results. + :keyword value: List of notificationChannels and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.NotificationChannel] + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -3817,150 +8055,279 @@ def __init__( self.next_link = next_link -class LinuxOsInfo(_serialization.Model): - """Information about a Linux OS. +class NotifyParameters(_serialization.Model): + """Properties for generating a Notification. - :ivar linux_os_state: The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, - DeprovisionApplied). Known values are: "NonDeprovisioned", "DeprovisionRequested", and - "DeprovisionApplied". - :vartype linux_os_state: str or ~azure.mgmt.devtestlabs.models.LinuxOsState + :ivar event_name: The type of event (i.e. AutoShutdown). "AutoShutdown" + :vartype event_name: str or ~azure.mgmt.devtestlabs.models.NotificationChannelEventType + :ivar json_payload: Properties for the notification in json format. + :vartype json_payload: str """ _attribute_map = { - "linux_os_state": {"key": "linuxOsState", "type": "str"}, + "event_name": {"key": "eventName", "type": "str"}, + "json_payload": {"key": "jsonPayload", "type": "str"}, } - def __init__(self, *, linux_os_state: Optional[Union[str, "_models.LinuxOsState"]] = None, **kwargs): + def __init__( + self, + *, + event_name: Optional[Union[str, "_models.NotificationChannelEventType"]] = None, + json_payload: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword linux_os_state: The state of the Linux OS (i.e. NonDeprovisioned, - DeprovisionRequested, DeprovisionApplied). Known values are: "NonDeprovisioned", - "DeprovisionRequested", and "DeprovisionApplied". - :paramtype linux_os_state: str or ~azure.mgmt.devtestlabs.models.LinuxOsState + :keyword event_name: The type of event (i.e. AutoShutdown). "AutoShutdown" + :paramtype event_name: str or ~azure.mgmt.devtestlabs.models.NotificationChannelEventType + :keyword json_payload: Properties for the notification in json format. + :paramtype json_payload: str """ super().__init__(**kwargs) - self.linux_os_state = linux_os_state + self.event_name = event_name + self.json_payload = json_payload -class NetworkInterfaceProperties(_serialization.Model): - """Properties of a network interface. +class OperationMetadata(_serialization.Model): + """The REST API operation supported by DevTestLab ResourceProvider. - :ivar virtual_network_id: The resource ID of the virtual network. - :vartype virtual_network_id: str - :ivar subnet_id: The resource ID of the sub net. - :vartype subnet_id: str - :ivar public_ip_address_id: The resource ID of the public IP address. - :vartype public_ip_address_id: str - :ivar public_ip_address: The public IP address. - :vartype public_ip_address: str - :ivar private_ip_address: The private IP address. - :vartype private_ip_address: str - :ivar dns_name: The DNS name. - :vartype dns_name: str - :ivar rdp_authority: The RdpAuthority property is a server DNS host name or IP address followed - by the service port number for RDP (Remote Desktop Protocol). - :vartype rdp_authority: str - :ivar ssh_authority: The SshAuthority property is a server DNS host name or IP address followed - by the service port number for SSH. - :vartype ssh_authority: str - :ivar shared_public_ip_address_configuration: The configuration for sharing a public IP address - across multiple virtual machines. - :vartype shared_public_ip_address_configuration: - ~azure.mgmt.devtestlabs.models.SharedPublicIpAddressConfiguration + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operations. + :vartype display: ~azure.mgmt.devtestlabs.models.OperationMetadataDisplay """ _attribute_map = { - "virtual_network_id": {"key": "virtualNetworkId", "type": "str"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - "public_ip_address_id": {"key": "publicIpAddressId", "type": "str"}, - "public_ip_address": {"key": "publicIpAddress", "type": "str"}, - "private_ip_address": {"key": "privateIpAddress", "type": "str"}, - "dns_name": {"key": "dnsName", "type": "str"}, - "rdp_authority": {"key": "rdpAuthority", "type": "str"}, - "ssh_authority": {"key": "sshAuthority", "type": "str"}, - "shared_public_ip_address_configuration": { - "key": "sharedPublicIpAddressConfiguration", - "type": "SharedPublicIpAddressConfiguration", - }, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationMetadataDisplay"}, + } + + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationMetadataDisplay"] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that describes the operations. + :paramtype display: ~azure.mgmt.devtestlabs.models.OperationMetadataDisplay + """ + super().__init__(**kwargs) + self.name = name + self.display = display + + +class OperationMetadataDisplay(_serialization.Model): + """The object that describes the operations. + + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar resource: Resource type on which the operation is performed. + :vartype resource: str + :ivar operation: Operation type: read, write, delete, listKeys/action, etc. + :vartype operation: str + :ivar description: Friendly name of the operation. + :vartype 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, *, - virtual_network_id: Optional[str] = None, - subnet_id: Optional[str] = None, - public_ip_address_id: Optional[str] = None, - public_ip_address: Optional[str] = None, - private_ip_address: Optional[str] = None, - dns_name: Optional[str] = None, - rdp_authority: Optional[str] = None, - ssh_authority: Optional[str] = None, - shared_public_ip_address_configuration: Optional["_models.SharedPublicIpAddressConfiguration"] = None, - **kwargs - ): + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword virtual_network_id: The resource ID of the virtual network. - :paramtype virtual_network_id: str - :keyword subnet_id: The resource ID of the sub net. - :paramtype subnet_id: str - :keyword public_ip_address_id: The resource ID of the public IP address. - :paramtype public_ip_address_id: str - :keyword public_ip_address: The public IP address. - :paramtype public_ip_address: str - :keyword private_ip_address: The private IP address. - :paramtype private_ip_address: str - :keyword dns_name: The DNS name. - :paramtype dns_name: str - :keyword rdp_authority: The RdpAuthority property is a server DNS host name or IP address - followed by the service port number for RDP (Remote Desktop Protocol). - :paramtype rdp_authority: str - :keyword ssh_authority: The SshAuthority property is a server DNS host name or IP address - followed by the service port number for SSH. - :paramtype ssh_authority: str - :keyword shared_public_ip_address_configuration: The configuration for sharing a public IP - address across multiple virtual machines. - :paramtype shared_public_ip_address_configuration: - ~azure.mgmt.devtestlabs.models.SharedPublicIpAddressConfiguration + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword resource: Resource type on which the operation is performed. + :paramtype resource: str + :keyword operation: Operation type: read, write, delete, listKeys/action, etc. + :paramtype operation: str + :keyword description: Friendly name of the operation. + :paramtype description: str """ super().__init__(**kwargs) - self.virtual_network_id = virtual_network_id - self.subnet_id = subnet_id - self.public_ip_address_id = public_ip_address_id - self.public_ip_address = public_ip_address - self.private_ip_address = private_ip_address - self.dns_name = dns_name - self.rdp_authority = rdp_authority - self.ssh_authority = ssh_authority - self.shared_public_ip_address_configuration = shared_public_ip_address_configuration + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationResult(_serialization.Model): + """An Operation Result. + + :ivar status: The operation status. + :vartype status: str + :ivar status_code: The status code for the operation. Known values are: "Continue", + "SwitchingProtocols", "Processing", "EarlyHints", "OK", "Created", "Accepted", + "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultiStatus", + "AlreadyReported", "IMUsed", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", + "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", + "TemporaryRedirect", "RedirectKeepVerb", "PermanentRedirect", "BadRequest", "Unauthorized", + "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", + "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", "LengthRequired", + "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", + "RequestedRangeNotSatisfiable", "ExpectationFailed", "MisdirectedRequest", + "UnprocessableEntity", "Locked", "FailedDependency", "UpgradeRequired", "PreconditionRequired", + "TooManyRequests", "RequestHeaderFieldsTooLarge", "UnavailableForLegalReasons", + "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", + "HttpVersionNotSupported", "VariantAlsoNegotiates", "InsufficientStorage", "LoopDetected", + "NotExtended", "NetworkAuthenticationRequired", and "Continue". + :vartype status_code: str or ~azure.mgmt.devtestlabs.models.HttpStatusCode + :ivar code: The error code of the operation error. + :vartype code: str + :ivar message: The error message of the operation error. + :vartype message: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "status_code": {"key": "statusCode", "type": "str"}, + "code": {"key": "error.code", "type": "str"}, + "message": {"key": "error.message", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: The operation status. + :paramtype status: str + :keyword status_code: The status code for the operation. Known values are: "Continue", + "SwitchingProtocols", "Processing", "EarlyHints", "OK", "Created", "Accepted", + "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultiStatus", + "AlreadyReported", "IMUsed", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", + "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", + "TemporaryRedirect", "RedirectKeepVerb", "PermanentRedirect", "BadRequest", "Unauthorized", + "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", + "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", "LengthRequired", + "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", + "RequestedRangeNotSatisfiable", "ExpectationFailed", "MisdirectedRequest", + "UnprocessableEntity", "Locked", "FailedDependency", "UpgradeRequired", "PreconditionRequired", + "TooManyRequests", "RequestHeaderFieldsTooLarge", "UnavailableForLegalReasons", + "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", + "HttpVersionNotSupported", "VariantAlsoNegotiates", "InsufficientStorage", "LoopDetected", + "NotExtended", "NetworkAuthenticationRequired", and "Continue". + :paramtype status_code: str or ~azure.mgmt.devtestlabs.models.HttpStatusCode + :keyword code: The error code of the operation error. + :paramtype code: str + :keyword message: The error message of the operation error. + :paramtype message: str + """ + super().__init__(**kwargs) + self.status = status + self.status_code = status_code + self.code = code + self.message = message + + +class ParameterInfo(_serialization.Model): + """Information about an artifact's parameter. + + :ivar name: The name of the artifact parameter. + :vartype name: str + :ivar value: The value of the artifact parameter. + :vartype value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of the artifact parameter. + :paramtype name: str + :keyword value: The value of the artifact parameter. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class ParametersValueFileInfo(_serialization.Model): + """A file containing a set of parameter values for an ARM template. + + :ivar file_name: File name. + :vartype file_name: str + :ivar parameters_value_info: Contents of the file. + :vartype parameters_value_info: JSON + """ + + _attribute_map = { + "file_name": {"key": "fileName", "type": "str"}, + "parameters_value_info": {"key": "parametersValueInfo", "type": "object"}, + } + + def __init__( + self, *, file_name: Optional[str] = None, parameters_value_info: Optional[JSON] = None, **kwargs: Any + ) -> None: + """ + :keyword file_name: File name. + :paramtype file_name: str + :keyword parameters_value_info: Contents of the file. + :paramtype parameters_value_info: JSON + """ + super().__init__(**kwargs) + self.file_name = file_name + self.parameters_value_info = parameters_value_info -class NotificationChannel(Resource): # pylint: disable=too-many-instance-attributes - """A notification. +class Policy(Resource): # pylint: disable=too-many-instance-attributes + """A Policy. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar web_hook_url: The webhook URL to send notifications to. - :vartype web_hook_url: str - :ivar email_recipient: The email recipient to send notifications to (can be a list of - semi-colon separated email addresses). - :vartype email_recipient: str - :ivar notification_locale: The locale to use when sending a notification (fallback for - unsupported languages is EN). - :vartype notification_locale: str - :ivar description: Description of notification. + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar description: The description of the policy. :vartype description: str - :ivar events: The list of event for which this notification is enabled. - :vartype events: list[~azure.mgmt.devtestlabs.models.Event] - :ivar created_date: The creation date of the notification channel. + :ivar status: The status of the policy. Known values are: "Enabled" and "Disabled". + :vartype status: str or ~azure.mgmt.devtestlabs.models.PolicyStatus + :ivar fact_name: The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, + etc. Known values are: "UserOwnedLabVmCount", "UserOwnedLabPremiumVmCount", "LabVmCount", + "LabPremiumVmCount", "LabVmSize", "GalleryImage", "UserOwnedLabVmCountInSubnet", + "EnvironmentTemplate", and "ScheduleEditPermission". + :vartype fact_name: str or ~azure.mgmt.devtestlabs.models.PolicyFactName + :ivar fact_data: The fact data of the policy. + :vartype fact_data: str + :ivar threshold: The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + array of values for AllowedValuesPolicy). + :vartype threshold: str + :ivar evaluator_type: The evaluator type of the policy (i.e. AllowedValuesPolicy, + MaxValuePolicy). Known values are: "AllowedValuesPolicy" and "MaxValuePolicy". + :vartype evaluator_type: str or ~azure.mgmt.devtestlabs.models.PolicyEvaluatorType + :ivar created_date: The creation date of the policy. :vartype created_date: ~datetime.datetime :ivar provisioning_state: The provisioning status of the resource. :vartype provisioning_state: str @@ -3972,6 +8339,8 @@ class NotificationChannel(Resource): # pylint: disable=too-many-instance-attrib "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "created_date": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, @@ -3981,13 +8350,15 @@ class NotificationChannel(Resource): # pylint: disable=too-many-instance-attrib "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "web_hook_url": {"key": "properties.webHookUrl", "type": "str"}, - "email_recipient": {"key": "properties.emailRecipient", "type": "str"}, - "notification_locale": {"key": "properties.notificationLocale", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "description": {"key": "properties.description", "type": "str"}, - "events": {"key": "properties.events", "type": "[Event]"}, + "status": {"key": "properties.status", "type": "str"}, + "fact_name": {"key": "properties.factName", "type": "str"}, + "fact_data": {"key": "properties.factData", "type": "str"}, + "threshold": {"key": "properties.threshold", "type": "str"}, + "evaluator_type": {"key": "properties.evaluatorType", "type": "str"}, "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, @@ -3996,84 +8367,103 @@ class NotificationChannel(Resource): # pylint: disable=too-many-instance-attrib def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - web_hook_url: Optional[str] = None, - email_recipient: Optional[str] = None, - notification_locale: Optional[str] = None, description: Optional[str] = None, - events: Optional[List["_models.Event"]] = None, - **kwargs - ): + status: Optional[Union[str, "_models.PolicyStatus"]] = None, + fact_name: Optional[Union[str, "_models.PolicyFactName"]] = None, + fact_data: Optional[str] = None, + threshold: Optional[str] = None, + evaluator_type: Optional[Union[str, "_models.PolicyEvaluatorType"]] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword web_hook_url: The webhook URL to send notifications to. - :paramtype web_hook_url: str - :keyword email_recipient: The email recipient to send notifications to (can be a list of - semi-colon separated email addresses). - :paramtype email_recipient: str - :keyword notification_locale: The locale to use when sending a notification (fallback for - unsupported languages is EN). - :paramtype notification_locale: str - :keyword description: Description of notification. + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword description: The description of the policy. :paramtype description: str - :keyword events: The list of event for which this notification is enabled. - :paramtype events: list[~azure.mgmt.devtestlabs.models.Event] + :keyword status: The status of the policy. Known values are: "Enabled" and "Disabled". + :paramtype status: str or ~azure.mgmt.devtestlabs.models.PolicyStatus + :keyword fact_name: The fact name of the policy (e.g. LabVmCount, LabVmSize, + MaxVmsAllowedPerLab, etc. Known values are: "UserOwnedLabVmCount", + "UserOwnedLabPremiumVmCount", "LabVmCount", "LabPremiumVmCount", "LabVmSize", "GalleryImage", + "UserOwnedLabVmCountInSubnet", "EnvironmentTemplate", and "ScheduleEditPermission". + :paramtype fact_name: str or ~azure.mgmt.devtestlabs.models.PolicyFactName + :keyword fact_data: The fact data of the policy. + :paramtype fact_data: str + :keyword threshold: The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON + array of values for AllowedValuesPolicy). + :paramtype threshold: str + :keyword evaluator_type: The evaluator type of the policy (i.e. AllowedValuesPolicy, + MaxValuePolicy). Known values are: "AllowedValuesPolicy" and "MaxValuePolicy". + :paramtype evaluator_type: str or ~azure.mgmt.devtestlabs.models.PolicyEvaluatorType """ - super().__init__(location=location, tags=tags, **kwargs) - self.web_hook_url = web_hook_url - self.email_recipient = email_recipient - self.notification_locale = notification_locale + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.description = description - self.events = events + self.status = status + self.fact_name = fact_name + self.fact_data = fact_data + self.threshold = threshold + self.evaluator_type = evaluator_type self.created_date = None self.provisioning_state = None self.unique_identifier = None -class NotificationChannelFragment(UpdateResource): - """A notification. +class PolicyFragment(UpdateResource): + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) -class NotificationChannelList(_serialization.Model): - """The response of a list operation. +class PolicyList(_serialization.Model): + """Contains a list of policies and their properties. - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.NotificationChannel] - :ivar next_link: Link for next set of results. + :ivar value: List of policies and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.Policy] + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[NotificationChannel]"}, + "value": {"key": "value", "type": "[Policy]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.NotificationChannel"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Policy"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.NotificationChannel] - :keyword next_link: Link for next set of results. + :keyword value: List of policies and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.Policy] + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -4081,105 +8471,137 @@ def __init__( self.next_link = next_link -class NotificationSettings(_serialization.Model): - """Notification settings for a schedule. +class PolicySet(Resource): + """A PolicySet. - :ivar status: If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known - values are: "Enabled" and "Disabled". - :vartype status: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :ivar time_in_minutes: Time in minutes before event at which notification will be sent. - :vartype time_in_minutes: int - :ivar webhook_url: The webhook URL to which the notification will be sent. - :vartype webhook_url: str - :ivar email_recipient: The email recipient to send notifications to (can be a list of - semi-colon separated email addresses). - :vartype email_recipient: str - :ivar notification_locale: The locale to use when sending a notification (fallback for - unsupported languages is EN). - :vartype notification_locale: str + 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :ivar unique_identifier: The unique immutable identifier of a resource (Guid). + :vartype unique_identifier: str """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "unique_identifier": {"readonly": True}, + } + _attribute_map = { - "status": {"key": "status", "type": "str"}, - "time_in_minutes": {"key": "timeInMinutes", "type": "int"}, - "webhook_url": {"key": "webhookUrl", "type": "str"}, - "email_recipient": {"key": "emailRecipient", "type": "str"}, - "notification_locale": {"key": "notificationLocale", "type": "str"}, + "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"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, } - def __init__( - self, - *, - status: Optional[Union[str, "_models.EnableStatus"]] = None, - time_in_minutes: Optional[int] = None, - webhook_url: Optional[str] = None, - email_recipient: Optional[str] = None, - notification_locale: Optional[str] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword status: If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known - values are: "Enabled" and "Disabled". - :paramtype status: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :keyword time_in_minutes: Time in minutes before event at which notification will be sent. - :paramtype time_in_minutes: int - :keyword webhook_url: The webhook URL to which the notification will be sent. - :paramtype webhook_url: str - :keyword email_recipient: The email recipient to send notifications to (can be a list of - semi-colon separated email addresses). - :paramtype email_recipient: str - :keyword notification_locale: The locale to use when sending a notification (fallback for - unsupported languages is EN). - :paramtype notification_locale: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.provisioning_state = None + self.unique_identifier = None + + +class PolicySetList(_serialization.Model): + """Contains a list of policySets and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of policySets and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.PolicySet] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PolicySet]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.status = status - self.time_in_minutes = time_in_minutes - self.webhook_url = webhook_url - self.email_recipient = email_recipient - self.notification_locale = notification_locale + self.value = None + self.next_link = next_link -class NotifyParameters(_serialization.Model): - """Properties for generating a Notification. +class PolicySetResult(_serialization.Model): + """Result of a policy set evaluation. - :ivar event_name: The type of event (i.e. AutoShutdown, Cost). Known values are: "AutoShutdown" - and "Cost". - :vartype event_name: str or ~azure.mgmt.devtestlabs.models.NotificationChannelEventType - :ivar json_payload: Properties for the notification in json format. - :vartype json_payload: str + :ivar has_error: A value indicating whether this policy set evaluation has discovered + violations. + :vartype has_error: bool + :ivar policy_violations: The list of policy violations. + :vartype policy_violations: list[~azure.mgmt.devtestlabs.models.PolicyViolation] """ _attribute_map = { - "event_name": {"key": "eventName", "type": "str"}, - "json_payload": {"key": "jsonPayload", "type": "str"}, + "has_error": {"key": "hasError", "type": "bool"}, + "policy_violations": {"key": "policyViolations", "type": "[PolicyViolation]"}, } def __init__( self, *, - event_name: Optional[Union[str, "_models.NotificationChannelEventType"]] = None, - json_payload: Optional[str] = None, - **kwargs - ): + has_error: Optional[bool] = None, + policy_violations: Optional[List["_models.PolicyViolation"]] = None, + **kwargs: Any + ) -> None: """ - :keyword event_name: The type of event (i.e. AutoShutdown, Cost). Known values are: - "AutoShutdown" and "Cost". - :paramtype event_name: str or ~azure.mgmt.devtestlabs.models.NotificationChannelEventType - :keyword json_payload: Properties for the notification in json format. - :paramtype json_payload: str + :keyword has_error: A value indicating whether this policy set evaluation has discovered + violations. + :paramtype has_error: bool + :keyword policy_violations: The list of policy violations. + :paramtype policy_violations: list[~azure.mgmt.devtestlabs.models.PolicyViolation] """ super().__init__(**kwargs) - self.event_name = event_name - self.json_payload = json_payload + self.has_error = has_error + self.policy_violations = policy_violations -class OperationError(_serialization.Model): - """Error details for the operation in case of a failure. +class PolicyViolation(_serialization.Model): + """Policy violation. - :ivar code: The error code of the operation error. + :ivar code: The code of the policy violation. :vartype code: str - :ivar message: The error message of the operation error. + :ivar message: The message of the policy violation. :vartype message: str """ @@ -4188,11 +8610,11 @@ class OperationError(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword code: The error code of the operation error. + :keyword code: The code of the policy violation. :paramtype code: str - :keyword message: The error message of the operation error. + :keyword message: The message of the policy violation. :paramtype message: str """ super().__init__(**kwargs) @@ -4200,835 +8622,1656 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, self.message = message -class OperationMetadata(_serialization.Model): - """The REST API operation supported by DevTestLab ResourceProvider. +class Port(_serialization.Model): + """Properties of a network port. - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operations. - :vartype display: ~azure.mgmt.devtestlabs.models.OperationMetadataDisplay + :ivar transport_protocol: Protocol type of the port. Known values are: "Tcp" and "Udp". + :vartype transport_protocol: str or ~azure.mgmt.devtestlabs.models.TransportProtocol + :ivar backend_port: Backend port of the target virtual machine. + :vartype backend_port: int """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationMetadataDisplay"}, + "transport_protocol": {"key": "transportProtocol", "type": "str"}, + "backend_port": {"key": "backendPort", "type": "int"}, } def __init__( - self, *, name: Optional[str] = None, display: Optional["_models.OperationMetadataDisplay"] = None, **kwargs - ): + self, + *, + transport_protocol: Optional[Union[str, "_models.TransportProtocol"]] = None, + backend_port: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that describes the operations. - :paramtype display: ~azure.mgmt.devtestlabs.models.OperationMetadataDisplay + :keyword transport_protocol: Protocol type of the port. Known values are: "Tcp" and "Udp". + :paramtype transport_protocol: str or ~azure.mgmt.devtestlabs.models.TransportProtocol + :keyword backend_port: Backend port of the target virtual machine. + :paramtype backend_port: int """ super().__init__(**kwargs) - self.name = name - self.display = display + self.transport_protocol = transport_protocol + self.backend_port = backend_port -class OperationMetadataDisplay(_serialization.Model): - """The object that describes the operations. +class ProviderOperationResult(_serialization.Model): + """Result of the request to list REST API operations. - :ivar provider: Friendly name of the resource provider. - :vartype provider: str - :ivar resource: Resource type on which the operation is performed. - :vartype resource: str - :ivar operation: Operation type: read, write, delete, listKeys/action, etc. - :vartype operation: str - :ivar description: Friendly name of the operation. - :vartype description: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.devtestlabs.models.OperationMetadata] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "value": {"key": "value", "type": "[OperationMetadata]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.OperationMetadata"]] = None, **kwargs: Any) -> None: """ - :keyword provider: Friendly name of the resource provider. - :paramtype provider: str - :keyword resource: Resource type on which the operation is performed. - :paramtype resource: str - :keyword operation: Operation type: read, write, delete, listKeys/action, etc. - :paramtype operation: str - :keyword description: Friendly name of the operation. - :paramtype description: str + :keyword value: List of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.devtestlabs.models.OperationMetadata] """ super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + self.value = value + self.next_link = None -class OperationResult(_serialization.Model): - """An Operation Result. +class RdpConnection(_serialization.Model): + """Represents a .rdp file. - :ivar status: The operation status. - :vartype status: str - :ivar status_code: The status code for the operation. Known values are: "Continue", - "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", - "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", - "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", - "TemporaryRedirect", "RedirectKeepVerb", "BadRequest", "Unauthorized", "PaymentRequired", - "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", "ProxyAuthenticationRequired", - "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", - "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", - "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", - "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", and - "HttpVersionNotSupported". - :vartype status_code: str or ~azure.mgmt.devtestlabs.models.HttpStatusCode - :ivar error: Error details for the operation in case of a failure. - :vartype error: ~azure.mgmt.devtestlabs.models.OperationError + :ivar contents: The contents of the .rdp file. + :vartype contents: str """ _attribute_map = { - "status": {"key": "status", "type": "str"}, - "status_code": {"key": "statusCode", "type": "str"}, - "error": {"key": "error", "type": "OperationError"}, + "contents": {"key": "contents", "type": "str"}, } - def __init__( - self, - *, - status: Optional[str] = None, - status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, - error: Optional["_models.OperationError"] = None, - **kwargs - ): + def __init__(self, *, contents: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword status: The operation status. - :paramtype status: str - :keyword status_code: The status code for the operation. Known values are: "Continue", - "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", - "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", - "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", - "TemporaryRedirect", "RedirectKeepVerb", "BadRequest", "Unauthorized", "PaymentRequired", - "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", "ProxyAuthenticationRequired", - "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", - "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", - "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", - "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", and - "HttpVersionNotSupported". - :paramtype status_code: str or ~azure.mgmt.devtestlabs.models.HttpStatusCode - :keyword error: Error details for the operation in case of a failure. - :paramtype error: ~azure.mgmt.devtestlabs.models.OperationError + :keyword contents: The contents of the .rdp file. + :paramtype contents: str """ super().__init__(**kwargs) - self.status = status - self.status_code = status_code - self.error = error + self.contents = contents -class ParameterInfo(_serialization.Model): - """Information about an artifact's parameter. +class ResizeLabVirtualMachineProperties(_serialization.Model): + """Request body for resizing a virtual machine. - :ivar name: The name of the artifact parameter. - :vartype name: str - :ivar value: The value of the artifact parameter. - :vartype value: str + :ivar size: Specifies the size of the virtual machine. + :vartype size: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "size": {"key": "size", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, size: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword name: The name of the artifact parameter. - :paramtype name: str - :keyword value: The value of the artifact parameter. - :paramtype value: str + :keyword size: Specifies the size of the virtual machine. + :paramtype size: str """ super().__init__(**kwargs) - self.name = name - self.value = value + self.size = size -class ParametersValueFileInfo(_serialization.Model): - """A file containing a set of parameter values for an ARM template. +class RetargetScheduleProperties(_serialization.Model): + """Properties for retargeting a virtual machine schedule. - :ivar file_name: File name. - :vartype file_name: str - :ivar parameters_value_info: Contents of the file. - :vartype parameters_value_info: JSON + :ivar current_resource_id: The resource Id of the virtual machine on which the schedule + operates. + :vartype current_resource_id: str + :ivar target_resource_id: The resource Id of the virtual machine that the schedule should be + retargeted to. + :vartype target_resource_id: str """ _attribute_map = { - "file_name": {"key": "fileName", "type": "str"}, - "parameters_value_info": {"key": "parametersValueInfo", "type": "object"}, + "current_resource_id": {"key": "currentResourceId", "type": "str"}, + "target_resource_id": {"key": "targetResourceId", "type": "str"}, } - def __init__(self, *, file_name: Optional[str] = None, parameters_value_info: Optional[JSON] = None, **kwargs): + def __init__( + self, *, current_resource_id: Optional[str] = None, target_resource_id: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword file_name: File name. - :paramtype file_name: str - :keyword parameters_value_info: Contents of the file. - :paramtype parameters_value_info: JSON + :keyword current_resource_id: The resource Id of the virtual machine on which the schedule + operates. + :paramtype current_resource_id: str + :keyword target_resource_id: The resource Id of the virtual machine that the schedule should be + retargeted to. + :paramtype target_resource_id: str """ super().__init__(**kwargs) - self.file_name = file_name - self.parameters_value_info = parameters_value_info + self.current_resource_id = current_resource_id + self.target_resource_id = target_resource_id + +class Schedule(Resource): # pylint: disable=too-many-instance-attributes + """A schedule. + + Variables are only populated by the server, and will be ignored when sending a request. -class PercentageCostThresholdProperties(_serialization.Model): - """Properties of a percentage cost threshold. + All required parameters must be populated in order to send to Azure. - :ivar threshold_value: The cost threshold value. - :vartype threshold_value: float + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_status: The status of the schedule (i.e. Enabled, Disabled). Known + values are: "Enabled" and "Disabled". + :vartype status_properties_status: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar task_type: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype task_type: str + :ivar time_zone_id: The time zone ID (e.g. Pacific Standard time). + :vartype time_zone_id: str + :ivar created_date: The creation date of the schedule. + :vartype created_date: ~datetime.datetime + :ivar target_resource_id: The resource ID to which the schedule belongs. + :vartype target_resource_id: str + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :ivar unique_identifier: The unique immutable identifier of a resource (Guid). + :vartype unique_identifier: str + :ivar status_properties_notification_settings_status: If notifications are enabled for this + schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_notification_settings_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar time_in_minutes: Time in minutes before event at which notification will be sent. + :vartype time_in_minutes: int + :ivar webhook_url: The webhook URL to which the notification will be sent. + :vartype webhook_url: str + :ivar email_recipient: The email recipient to send notifications to (can be a list of + semi-colon separated email addresses). + :vartype email_recipient: str + :ivar notification_locale: The locale to use when sending a notification (fallback for + unsupported languages is EN). + :vartype notification_locale: str + :ivar minute: Minutes of the hour the schedule will run. + :vartype minute: int + :ivar time_properties_daily_recurrence_time: The time of day the schedule will occur. + :vartype time_properties_daily_recurrence_time: str + :ivar weekdays: The days of the week for which the schedule is set (e.g. Sunday, Monday, + Tuesday, etc.). + :vartype weekdays: list[str] + :ivar time_properties_weekly_recurrence_time: The time of the day the schedule will occur. + :vartype time_properties_weekly_recurrence_time: str """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "created_date": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "unique_identifier": {"readonly": True}, + } + _attribute_map = { - "threshold_value": {"key": "thresholdValue", "type": "float"}, + "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"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "status_properties_status": {"key": "properties.status", "type": "str"}, + "task_type": {"key": "properties.taskType", "type": "str"}, + "time_zone_id": {"key": "properties.timeZoneId", "type": "str"}, + "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, + "target_resource_id": {"key": "properties.targetResourceId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "status_properties_notification_settings_status": { + "key": "properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes": {"key": "properties.notificationSettings.timeInMinutes", "type": "int"}, + "webhook_url": {"key": "properties.notificationSettings.webhookUrl", "type": "str"}, + "email_recipient": {"key": "properties.notificationSettings.emailRecipient", "type": "str"}, + "notification_locale": {"key": "properties.notificationSettings.notificationLocale", "type": "str"}, + "minute": {"key": "properties.hourlyRecurrence.minute", "type": "int"}, + "time_properties_daily_recurrence_time": {"key": "properties.dailyRecurrence.time", "type": "str"}, + "weekdays": {"key": "properties.weeklyRecurrence.weekdays", "type": "[str]"}, + "time_properties_weekly_recurrence_time": {"key": "properties.weeklyRecurrence.time", "type": "str"}, } - def __init__(self, *, threshold_value: Optional[float] = None, **kwargs): - """ - :keyword threshold_value: The cost threshold value. - :paramtype threshold_value: float + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + status_properties_status: Optional[Union[str, "_models.EnableStatus"]] = None, + task_type: Optional[str] = None, + time_zone_id: Optional[str] = None, + target_resource_id: Optional[str] = None, + status_properties_notification_settings_status: Optional[Union[str, "_models.EnableStatus"]] = None, + time_in_minutes: Optional[int] = None, + webhook_url: Optional[str] = None, + email_recipient: Optional[str] = None, + notification_locale: Optional[str] = None, + minute: Optional[int] = None, + time_properties_daily_recurrence_time: Optional[str] = None, + weekdays: Optional[List[str]] = None, + time_properties_weekly_recurrence_time: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword status_properties_status: The status of the schedule (i.e. Enabled, Disabled). Known + values are: "Enabled" and "Disabled". + :paramtype status_properties_status: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword task_type: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype task_type: str + :keyword time_zone_id: The time zone ID (e.g. Pacific Standard time). + :paramtype time_zone_id: str + :keyword target_resource_id: The resource ID to which the schedule belongs. + :paramtype target_resource_id: str + :keyword status_properties_notification_settings_status: If notifications are enabled for this + schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :paramtype status_properties_notification_settings_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword time_in_minutes: Time in minutes before event at which notification will be sent. + :paramtype time_in_minutes: int + :keyword webhook_url: The webhook URL to which the notification will be sent. + :paramtype webhook_url: str + :keyword email_recipient: The email recipient to send notifications to (can be a list of + semi-colon separated email addresses). + :paramtype email_recipient: str + :keyword notification_locale: The locale to use when sending a notification (fallback for + unsupported languages is EN). + :paramtype notification_locale: str + :keyword minute: Minutes of the hour the schedule will run. + :paramtype minute: int + :keyword time_properties_daily_recurrence_time: The time of day the schedule will occur. + :paramtype time_properties_daily_recurrence_time: str + :keyword weekdays: The days of the week for which the schedule is set (e.g. Sunday, Monday, + Tuesday, etc.). + :paramtype weekdays: list[str] + :keyword time_properties_weekly_recurrence_time: The time of the day the schedule will occur. + :paramtype time_properties_weekly_recurrence_time: str """ - super().__init__(**kwargs) - self.threshold_value = threshold_value + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.status_properties_status = status_properties_status + self.task_type = task_type + self.time_zone_id = time_zone_id + self.created_date = None + self.target_resource_id = target_resource_id + self.provisioning_state = None + self.unique_identifier = None + self.status_properties_notification_settings_status = status_properties_notification_settings_status + self.time_in_minutes = time_in_minutes + self.webhook_url = webhook_url + self.email_recipient = email_recipient + self.notification_locale = notification_locale + self.minute = minute + self.time_properties_daily_recurrence_time = time_properties_daily_recurrence_time + self.weekdays = weekdays + self.time_properties_weekly_recurrence_time = time_properties_weekly_recurrence_time -class Policy(Resource): # pylint: disable=too-many-instance-attributes - """A Policy. +class ScheduleCreationParameter(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Properties for creating a schedule. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. - :vartype id: str - :ivar name: The name of the resource. + :ivar name: The name of the virtual machine or environment. :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar location: The location of the resource. + :ivar location: The location of the new virtual machine or environment. :vartype location: str :ivar tags: The tags of the resource. :vartype tags: dict[str, str] - :ivar description: The description of the policy. - :vartype description: str - :ivar status: The status of the policy. Known values are: "Enabled" and "Disabled". - :vartype status: str or ~azure.mgmt.devtestlabs.models.PolicyStatus - :ivar fact_name: The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, - etc. Known values are: "UserOwnedLabVmCount", "UserOwnedLabPremiumVmCount", "LabVmCount", - "LabPremiumVmCount", "LabVmSize", "GalleryImage", "UserOwnedLabVmCountInSubnet", - "LabTargetCost", "EnvironmentTemplate", and "ScheduleEditPermission". - :vartype fact_name: str or ~azure.mgmt.devtestlabs.models.PolicyFactName - :ivar fact_data: The fact data of the policy. - :vartype fact_data: str - :ivar threshold: The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON - array of values for AllowedValuesPolicy). - :vartype threshold: str - :ivar evaluator_type: The evaluator type of the policy (i.e. AllowedValuesPolicy, - MaxValuePolicy). Known values are: "AllowedValuesPolicy" and "MaxValuePolicy". - :vartype evaluator_type: str or ~azure.mgmt.devtestlabs.models.PolicyEvaluatorType - :ivar created_date: The creation date of the policy. + :ivar status_properties_status: The status of the schedule (i.e. Enabled, Disabled). Known + values are: "Enabled" and "Disabled". + :vartype status_properties_status: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar task_type: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype task_type: str + :ivar time_zone_id: The time zone ID (e.g. Pacific Standard time). + :vartype time_zone_id: str + :ivar created_date: The creation date of the schedule. :vartype created_date: ~datetime.datetime + :ivar target_resource_id: The resource ID to which the schedule belongs. + :vartype target_resource_id: str :ivar provisioning_state: The provisioning status of the resource. :vartype provisioning_state: str :ivar unique_identifier: The unique immutable identifier of a resource (Guid). :vartype unique_identifier: str + :ivar status_properties_notification_settings_status: If notifications are enabled for this + schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_notification_settings_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar time_in_minutes: Time in minutes before event at which notification will be sent. + :vartype time_in_minutes: int + :ivar webhook_url: The webhook URL to which the notification will be sent. + :vartype webhook_url: str + :ivar email_recipient: The email recipient to send notifications to (can be a list of + semi-colon separated email addresses). + :vartype email_recipient: str + :ivar notification_locale: The locale to use when sending a notification (fallback for + unsupported languages is EN). + :vartype notification_locale: str + :ivar minute: Minutes of the hour the schedule will run. + :vartype minute: int + :ivar time_properties_daily_recurrence_time: The time of day the schedule will occur. + :vartype time_properties_daily_recurrence_time: str + :ivar weekdays: The days of the week for which the schedule is set (e.g. Sunday, Monday, + Tuesday, etc.). + :vartype weekdays: list[str] + :ivar time_properties_weekly_recurrence_time: The time of the day the schedule will occur. + :vartype time_properties_weekly_recurrence_time: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "location": {"readonly": True}, "created_date": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "fact_name": {"key": "properties.factName", "type": "str"}, - "fact_data": {"key": "properties.factData", "type": "str"}, - "threshold": {"key": "properties.threshold", "type": "str"}, - "evaluator_type": {"key": "properties.evaluatorType", "type": "str"}, + "status_properties_status": {"key": "properties.status", "type": "str"}, + "task_type": {"key": "properties.taskType", "type": "str"}, + "time_zone_id": {"key": "properties.timeZoneId", "type": "str"}, "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, + "target_resource_id": {"key": "properties.targetResourceId", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "status_properties_notification_settings_status": { + "key": "properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes": {"key": "properties.notificationSettings.timeInMinutes", "type": "int"}, + "webhook_url": {"key": "properties.notificationSettings.webhookUrl", "type": "str"}, + "email_recipient": {"key": "properties.notificationSettings.emailRecipient", "type": "str"}, + "notification_locale": {"key": "properties.notificationSettings.notificationLocale", "type": "str"}, + "minute": {"key": "properties.hourlyRecurrence.minute", "type": "int"}, + "time_properties_daily_recurrence_time": {"key": "properties.dailyRecurrence.time", "type": "str"}, + "weekdays": {"key": "properties.weeklyRecurrence.weekdays", "type": "[str]"}, + "time_properties_weekly_recurrence_time": {"key": "properties.weeklyRecurrence.time", "type": "str"}, } def __init__( self, *, - location: Optional[str] = None, + name: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - description: Optional[str] = None, - status: Optional[Union[str, "_models.PolicyStatus"]] = None, - fact_name: Optional[Union[str, "_models.PolicyFactName"]] = None, - fact_data: Optional[str] = None, - threshold: Optional[str] = None, - evaluator_type: Optional[Union[str, "_models.PolicyEvaluatorType"]] = None, - **kwargs - ): + status_properties_status: Optional[Union[str, "_models.EnableStatus"]] = None, + task_type: Optional[str] = None, + time_zone_id: Optional[str] = None, + target_resource_id: Optional[str] = None, + status_properties_notification_settings_status: Optional[Union[str, "_models.EnableStatus"]] = None, + time_in_minutes: Optional[int] = None, + webhook_url: Optional[str] = None, + email_recipient: Optional[str] = None, + notification_locale: Optional[str] = None, + minute: Optional[int] = None, + time_properties_daily_recurrence_time: Optional[str] = None, + weekdays: Optional[List[str]] = None, + time_properties_weekly_recurrence_time: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str + :keyword name: The name of the virtual machine or environment. + :paramtype name: str :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] - :keyword description: The description of the policy. - :paramtype description: str - :keyword status: The status of the policy. Known values are: "Enabled" and "Disabled". - :paramtype status: str or ~azure.mgmt.devtestlabs.models.PolicyStatus - :keyword fact_name: The fact name of the policy (e.g. LabVmCount, LabVmSize, - MaxVmsAllowedPerLab, etc. Known values are: "UserOwnedLabVmCount", - "UserOwnedLabPremiumVmCount", "LabVmCount", "LabPremiumVmCount", "LabVmSize", "GalleryImage", - "UserOwnedLabVmCountInSubnet", "LabTargetCost", "EnvironmentTemplate", and - "ScheduleEditPermission". - :paramtype fact_name: str or ~azure.mgmt.devtestlabs.models.PolicyFactName - :keyword fact_data: The fact data of the policy. - :paramtype fact_data: str - :keyword threshold: The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON - array of values for AllowedValuesPolicy). - :paramtype threshold: str - :keyword evaluator_type: The evaluator type of the policy (i.e. AllowedValuesPolicy, - MaxValuePolicy). Known values are: "AllowedValuesPolicy" and "MaxValuePolicy". - :paramtype evaluator_type: str or ~azure.mgmt.devtestlabs.models.PolicyEvaluatorType + :keyword status_properties_status: The status of the schedule (i.e. Enabled, Disabled). Known + values are: "Enabled" and "Disabled". + :paramtype status_properties_status: str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword task_type: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype task_type: str + :keyword time_zone_id: The time zone ID (e.g. Pacific Standard time). + :paramtype time_zone_id: str + :keyword target_resource_id: The resource ID to which the schedule belongs. + :paramtype target_resource_id: str + :keyword status_properties_notification_settings_status: If notifications are enabled for this + schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :paramtype status_properties_notification_settings_status: str or + ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword time_in_minutes: Time in minutes before event at which notification will be sent. + :paramtype time_in_minutes: int + :keyword webhook_url: The webhook URL to which the notification will be sent. + :paramtype webhook_url: str + :keyword email_recipient: The email recipient to send notifications to (can be a list of + semi-colon separated email addresses). + :paramtype email_recipient: str + :keyword notification_locale: The locale to use when sending a notification (fallback for + unsupported languages is EN). + :paramtype notification_locale: str + :keyword minute: Minutes of the hour the schedule will run. + :paramtype minute: int + :keyword time_properties_daily_recurrence_time: The time of day the schedule will occur. + :paramtype time_properties_daily_recurrence_time: str + :keyword weekdays: The days of the week for which the schedule is set (e.g. Sunday, Monday, + Tuesday, etc.). + :paramtype weekdays: list[str] + :keyword time_properties_weekly_recurrence_time: The time of the day the schedule will occur. + :paramtype time_properties_weekly_recurrence_time: str """ - super().__init__(location=location, tags=tags, **kwargs) - self.description = description - self.status = status - self.fact_name = fact_name - self.fact_data = fact_data - self.threshold = threshold - self.evaluator_type = evaluator_type + super().__init__(**kwargs) + self.name = name + self.location = None + self.tags = tags + self.status_properties_status = status_properties_status + self.task_type = task_type + self.time_zone_id = time_zone_id self.created_date = None + self.target_resource_id = target_resource_id self.provisioning_state = None self.unique_identifier = None + self.status_properties_notification_settings_status = status_properties_notification_settings_status + self.time_in_minutes = time_in_minutes + self.webhook_url = webhook_url + self.email_recipient = email_recipient + self.notification_locale = notification_locale + self.minute = minute + self.time_properties_daily_recurrence_time = time_properties_daily_recurrence_time + self.weekdays = weekdays + self.time_properties_weekly_recurrence_time = time_properties_weekly_recurrence_time -class PolicyFragment(UpdateResource): - """A Policy. +class ScheduleFragment(UpdateResource): + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - """ - super().__init__(tags=tags, **kwargs) - - -class PolicyList(_serialization.Model): - """The response of a list operation. - - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.Policy] - :ivar next_link: Link for next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Policy]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.Policy"]] = None, next_link: Optional[str] = None, **kwargs): - """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.Policy] - :keyword next_link: Link for next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PolicySetResult(_serialization.Model): - """Result of a policy set evaluation. - - :ivar has_error: A value indicating whether this policy set evaluation has discovered - violations. - :vartype has_error: bool - :ivar policy_violations: The list of policy violations. - :vartype policy_violations: list[~azure.mgmt.devtestlabs.models.PolicyViolation] - """ - - _attribute_map = { - "has_error": {"key": "hasError", "type": "bool"}, - "policy_violations": {"key": "policyViolations", "type": "[PolicyViolation]"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } def __init__( self, *, - has_error: Optional[bool] = None, - policy_violations: Optional[List["_models.PolicyViolation"]] = None, - **kwargs - ): - """ - :keyword has_error: A value indicating whether this policy set evaluation has discovered - violations. - :paramtype has_error: bool - :keyword policy_violations: The list of policy violations. - :paramtype policy_violations: list[~azure.mgmt.devtestlabs.models.PolicyViolation] - """ - super().__init__(**kwargs) - self.has_error = has_error - self.policy_violations = policy_violations - - -class PolicyViolation(_serialization.Model): - """Policy violation. - - :ivar code: The code of the policy violation. - :vartype code: str - :ivar message: The message of the policy violation. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword code: The code of the policy violation. - :paramtype code: str - :keyword message: The message of the policy violation. - :paramtype message: str + :keyword tags: The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(**kwargs) - self.code = code - self.message = message - + super().__init__(tags=tags, identity=identity, **kwargs) -class Port(_serialization.Model): - """Properties of a network port. - :ivar transport_protocol: Protocol type of the port. Known values are: "Tcp" and "Udp". - :vartype transport_protocol: str or ~azure.mgmt.devtestlabs.models.TransportProtocol - :ivar backend_port: Backend port of the target virtual machine. - :vartype backend_port: int +class ScheduleList(_serialization.Model): + """Contains a list of schedules and their properties. + + :ivar value: List of schedules and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.Schedule] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { - "transport_protocol": {"key": "transportProtocol", "type": "str"}, - "backend_port": {"key": "backendPort", "type": "int"}, + "value": {"key": "value", "type": "[Schedule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - transport_protocol: Optional[Union[str, "_models.TransportProtocol"]] = None, - backend_port: Optional[int] = None, - **kwargs - ): + self, *, value: Optional[List["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword transport_protocol: Protocol type of the port. Known values are: "Tcp" and "Udp". - :paramtype transport_protocol: str or ~azure.mgmt.devtestlabs.models.TransportProtocol - :keyword backend_port: Backend port of the target virtual machine. - :paramtype backend_port: int + :keyword value: List of schedules and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.Schedule] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.transport_protocol = transport_protocol - self.backend_port = backend_port + self.value = value + self.next_link = next_link -class ProviderOperationResult(_serialization.Model): - """Result of the request to list REST API operations. +class Secret(Resource): + """A secret. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.devtestlabs.models.OperationMetadata] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar value: The value of the secret for secret creation. + :vartype value: str + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :ivar unique_identifier: The unique immutable identifier of a resource (Guid). + :vartype unique_identifier: str """ _validation = { - "next_link": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "unique_identifier": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[OperationMetadata]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "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"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "value": {"key": "properties.value", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.OperationMetadata"]] = None, **kwargs): + def __init__( + self, *, location: str, tags: Optional[Dict[str, str]] = None, value: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: List of operations supported by the resource provider. - :paramtype value: list[~azure.mgmt.devtestlabs.models.OperationMetadata] + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword value: The value of the secret for secret creation. + :paramtype value: str """ - super().__init__(**kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.value = value - self.next_link = None + self.provisioning_state = None + self.unique_identifier = None -class RdpConnection(_serialization.Model): - """Represents a .rdp file. +class SecretFragment(UpdateResource): + """Patch. - :ivar contents: The contents of the .rdp file. - :vartype contents: str + :ivar tags: The tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { - "contents": {"key": "contents", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, contents: Optional[str] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword contents: The contents of the .rdp file. - :paramtype contents: str + :keyword tags: The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(**kwargs) - self.contents = contents + super().__init__(tags=tags, identity=identity, **kwargs) -class ResizeLabVirtualMachineProperties(_serialization.Model): - """Request body for resizing a virtual machine. +class SecretList(_serialization.Model): + """Contains a list of secrets and their properties. - :ivar size: Specifies the size of the virtual machine. - :vartype size: str + :ivar value: List of secrets and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.Secret] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { - "size": {"key": "size", "type": "str"}, + "value": {"key": "value", "type": "[Secret]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, size: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword size: Specifies the size of the virtual machine. - :paramtype size: str + :keyword value: List of secrets and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.Secret] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.size = size + self.value = value + self.next_link = next_link -class RetargetScheduleProperties(_serialization.Model): - """Properties for retargeting a virtual machine schedule. +class SecurityProfile(_serialization.Model): + """The security profile settings for a virtual machine. - :ivar current_resource_id: The resource Id of the virtual machine on which the schedule - operates. - :vartype current_resource_id: str - :ivar target_resource_id: The resource Id of the virtual machine that the schedule should be - retargeted to. - :vartype target_resource_id: str + :ivar security_type: Specifies the SecurityType of the virtual machine. It has to be set to any + specified value to enable UefiSettings. :code:`
`:code:`
` Default: UefiSettings will not + be enabled unless this property is set. Known values are: "TrustedLaunch" and "ConfidentialVM". + :vartype security_type: str or ~azure.mgmt.devtestlabs.models.SecurityTypes + :ivar uefi_settings: Security settings like secure boot and vTPM. Structure must be null if + SecurityType string is null. + :vartype uefi_settings: ~azure.mgmt.devtestlabs.models.UefiSettings """ _attribute_map = { - "current_resource_id": {"key": "currentResourceId", "type": "str"}, - "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "security_type": {"key": "securityType", "type": "str"}, + "uefi_settings": {"key": "uefiSettings", "type": "UefiSettings"}, } def __init__( - self, *, current_resource_id: Optional[str] = None, target_resource_id: Optional[str] = None, **kwargs - ): - """ - :keyword current_resource_id: The resource Id of the virtual machine on which the schedule - operates. - :paramtype current_resource_id: str - :keyword target_resource_id: The resource Id of the virtual machine that the schedule should be - retargeted to. - :paramtype target_resource_id: str + self, + *, + security_type: Optional[Union[str, "_models.SecurityTypes"]] = None, + uefi_settings: Optional["_models.UefiSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword security_type: Specifies the SecurityType of the virtual machine. It has to be set to + any specified value to enable UefiSettings. :code:`
`:code:`
` Default: UefiSettings will + not be enabled unless this property is set. Known values are: "TrustedLaunch" and + "ConfidentialVM". + :paramtype security_type: str or ~azure.mgmt.devtestlabs.models.SecurityTypes + :keyword uefi_settings: Security settings like secure boot and vTPM. Structure must be null if + SecurityType string is null. + :paramtype uefi_settings: ~azure.mgmt.devtestlabs.models.UefiSettings """ super().__init__(**kwargs) - self.current_resource_id = current_resource_id - self.target_resource_id = target_resource_id + self.security_type = security_type + self.uefi_settings = uefi_settings -class Schedule(Resource): # pylint: disable=too-many-instance-attributes - """A schedule. +class ServiceFabric(Resource): # pylint: disable=too-many-instance-attributes + """A Service Fabric. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar status: The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" - and "Disabled". - :vartype status: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :ivar task_type: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - :vartype task_type: str - :ivar weekly_recurrence: If the schedule will occur only some days of the week, specify the - weekly recurrence. - :vartype weekly_recurrence: ~azure.mgmt.devtestlabs.models.WeekDetails - :ivar daily_recurrence: If the schedule will occur once each day of the week, specify the daily - recurrence. - :vartype daily_recurrence: ~azure.mgmt.devtestlabs.models.DayDetails - :ivar hourly_recurrence: If the schedule will occur multiple times a day, specify the hourly - recurrence. - :vartype hourly_recurrence: ~azure.mgmt.devtestlabs.models.HourDetails - :ivar time_zone_id: The time zone ID (e.g. Pacific Standard time). - :vartype time_zone_id: str - :ivar notification_settings: Notification settings. - :vartype notification_settings: ~azure.mgmt.devtestlabs.models.NotificationSettings - :ivar created_date: The creation date of the schedule. - :vartype created_date: ~datetime.datetime - :ivar target_resource_id: The resource ID to which the schedule belongs. - :vartype target_resource_id: str - :ivar provisioning_state: The provisioning status of the resource. - :vartype provisioning_state: str - :ivar unique_identifier: The unique immutable identifier of a resource (Guid). - :vartype unique_identifier: str + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar external_service_fabric_id: The backing service fabric resource's id. + :vartype external_service_fabric_id: str + :ivar environment_id: The resource id of the environment under which the service fabric + resource is present. + :vartype environment_id: str + :ivar provisioning_state_properties_provisioning_state: The provisioning status of the + resource. + :vartype provisioning_state_properties_provisioning_state: str + :ivar unique_identifier_properties_unique_identifier: The unique immutable identifier of a + resource (Guid). + :vartype unique_identifier_properties_unique_identifier: str + :ivar id_properties_applicable_schedule_id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_id: str + :ivar name_properties_applicable_schedule_name: The name of the resource. + :vartype name_properties_applicable_schedule_name: str + :ivar type_properties_applicable_schedule_type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_type: str + :ivar tags_properties_applicable_schedule_tags: Resource tags. + :vartype tags_properties_applicable_schedule_tags: dict[str, str] + :ivar location_properties_applicable_schedule_location: The geo-location where the resource + lives. + :vartype location_properties_applicable_schedule_location: str + :ivar system_data_properties_applicable_schedule_system_data: The system metadata relating to + this resource. + :vartype system_data_properties_applicable_schedule_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar id_properties_applicable_schedule_properties_lab_vms_startup_id: Fully qualified resource + ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_properties_lab_vms_startup_id: str + :ivar name_properties_applicable_schedule_properties_lab_vms_startup_name: The name of the + resource. + :vartype name_properties_applicable_schedule_properties_lab_vms_startup_name: str + :ivar type_properties_applicable_schedule_properties_lab_vms_startup_type: The type of the + resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_properties_lab_vms_startup_type: str + :ivar tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Resource tags. + :vartype tags_properties_applicable_schedule_properties_lab_vms_startup_tags: dict[str, str] + :ivar location_properties_applicable_schedule_properties_lab_vms_startup_location: The + geo-location where the resource lives. + :vartype location_properties_applicable_schedule_properties_lab_vms_startup_location: str + :ivar system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data: The + system metadata relating to this resource. + :vartype system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: The + status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: + The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: str + :ivar + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :vartype + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + str + :ivar + created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date: + The creation date of the schedule. + :vartype + created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date: + ~datetime.datetime + :ivar + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + The resource ID to which the schedule belongs. + :vartype + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + str + :ivar + provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state: + The provisioning status of the resource. + :vartype + provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state: + str + :ivar + unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier: + The unique immutable identifier of a resource (Guid). + :vartype + unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier: + str + :ivar + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :ivar + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :vartype + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :ivar + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :vartype + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + int + :ivar + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + The time of day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + str + :ivar + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + list[str] + :ivar + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + str + :ivar id_properties_applicable_schedule_properties_lab_vms_shutdown_id: Fully qualified + resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id_properties_applicable_schedule_properties_lab_vms_shutdown_id: str + :ivar name_properties_applicable_schedule_properties_lab_vms_shutdown_name: The name of the + resource. + :vartype name_properties_applicable_schedule_properties_lab_vms_shutdown_name: str + :ivar type_properties_applicable_schedule_properties_lab_vms_shutdown_type: The type of the + resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + :vartype type_properties_applicable_schedule_properties_lab_vms_shutdown_type: str + :ivar tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Resource tags. + :vartype tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: dict[str, str] + :ivar location_properties_applicable_schedule_properties_lab_vms_shutdown_location: The + geo-location where the resource lives. + :vartype location_properties_applicable_schedule_properties_lab_vms_shutdown_location: str + :ivar system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data: The + system metadata relating to this resource. + :vartype system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data: + ~azure.mgmt.devtestlabs.models.SystemData + :ivar status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: The + status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". + :vartype status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :vartype + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: str + :ivar + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :vartype + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + str + :ivar + created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date: + The creation date of the schedule. + :vartype + created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date: + ~datetime.datetime + :ivar + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + The resource ID to which the schedule belongs. + :vartype + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + str + :ivar + provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state: + The provisioning status of the resource. + :vartype + provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state: + str + :ivar + unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier: + The unique immutable identifier of a resource (Guid). + :vartype + unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier: + str + :ivar + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :vartype + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :ivar + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :vartype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :ivar + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :vartype + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :ivar + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :vartype + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :ivar + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :vartype + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :ivar + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :vartype + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + int + :ivar + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + The time of day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + str + :ivar + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :vartype + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :ivar + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :vartype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "created_date": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "unique_identifier": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state_properties_provisioning_state": {"readonly": True}, + "unique_identifier_properties_unique_identifier": {"readonly": True}, + "id_properties_applicable_schedule_id": {"readonly": True}, + "name_properties_applicable_schedule_name": {"readonly": True}, + "type_properties_applicable_schedule_type": {"readonly": True}, + "system_data_properties_applicable_schedule_system_data": {"readonly": True}, + "id_properties_applicable_schedule_properties_lab_vms_startup_id": {"readonly": True}, + "name_properties_applicable_schedule_properties_lab_vms_startup_name": {"readonly": True}, + "type_properties_applicable_schedule_properties_lab_vms_startup_type": {"readonly": True}, + "system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data": {"readonly": True}, + "created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date": { + "readonly": True + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state": { + "readonly": True + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier": { + "readonly": True + }, + "id_properties_applicable_schedule_properties_lab_vms_shutdown_id": {"readonly": True}, + "name_properties_applicable_schedule_properties_lab_vms_shutdown_name": {"readonly": True}, + "type_properties_applicable_schedule_properties_lab_vms_shutdown_type": {"readonly": True}, + "system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data": {"readonly": True}, + "created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date": { + "readonly": True + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state": { + "readonly": True + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier": { + "readonly": True + }, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "status": {"key": "properties.status", "type": "str"}, - "task_type": {"key": "properties.taskType", "type": "str"}, - "weekly_recurrence": {"key": "properties.weeklyRecurrence", "type": "WeekDetails"}, - "daily_recurrence": {"key": "properties.dailyRecurrence", "type": "DayDetails"}, - "hourly_recurrence": {"key": "properties.hourlyRecurrence", "type": "HourDetails"}, - "time_zone_id": {"key": "properties.timeZoneId", "type": "str"}, - "notification_settings": {"key": "properties.notificationSettings", "type": "NotificationSettings"}, - "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, - "target_resource_id": {"key": "properties.targetResourceId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - status: Optional[Union[str, "_models.EnableStatus"]] = None, - task_type: Optional[str] = None, - weekly_recurrence: Optional["_models.WeekDetails"] = None, - daily_recurrence: Optional["_models.DayDetails"] = None, - hourly_recurrence: Optional["_models.HourDetails"] = None, - time_zone_id: Optional[str] = None, - notification_settings: Optional["_models.NotificationSettings"] = None, - target_resource_id: Optional[str] = None, - **kwargs - ): - """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - :keyword status: The status of the schedule (i.e. Enabled, Disabled). Known values are: - "Enabled" and "Disabled". - :paramtype status: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :keyword task_type: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - :paramtype task_type: str - :keyword weekly_recurrence: If the schedule will occur only some days of the week, specify the - weekly recurrence. - :paramtype weekly_recurrence: ~azure.mgmt.devtestlabs.models.WeekDetails - :keyword daily_recurrence: If the schedule will occur once each day of the week, specify the - daily recurrence. - :paramtype daily_recurrence: ~azure.mgmt.devtestlabs.models.DayDetails - :keyword hourly_recurrence: If the schedule will occur multiple times a day, specify the hourly - recurrence. - :paramtype hourly_recurrence: ~azure.mgmt.devtestlabs.models.HourDetails - :keyword time_zone_id: The time zone ID (e.g. Pacific Standard time). - :paramtype time_zone_id: str - :keyword notification_settings: Notification settings. - :paramtype notification_settings: ~azure.mgmt.devtestlabs.models.NotificationSettings - :keyword target_resource_id: The resource ID to which the schedule belongs. - :paramtype target_resource_id: str - """ - super().__init__(location=location, tags=tags, **kwargs) - self.status = status - self.task_type = task_type - self.weekly_recurrence = weekly_recurrence - self.daily_recurrence = daily_recurrence - self.hourly_recurrence = hourly_recurrence - self.time_zone_id = time_zone_id - self.notification_settings = notification_settings - self.created_date = None - self.target_resource_id = target_resource_id - self.provisioning_state = None - self.unique_identifier = None - - -class ScheduleCreationParameter(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Properties for creating a schedule. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the virtual machine or environment. - :vartype name: str - :ivar location: The location of the new virtual machine or environment. - :vartype location: str - :ivar tags: The tags of the resource. - :vartype tags: dict[str, str] - :ivar status: The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" - and "Disabled". - :vartype status: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :ivar task_type: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - :vartype task_type: str - :ivar weekly_recurrence: If the schedule will occur only some days of the week, specify the - weekly recurrence. - :vartype weekly_recurrence: ~azure.mgmt.devtestlabs.models.WeekDetails - :ivar daily_recurrence: If the schedule will occur once each day of the week, specify the daily - recurrence. - :vartype daily_recurrence: ~azure.mgmt.devtestlabs.models.DayDetails - :ivar hourly_recurrence: If the schedule will occur multiple times a day, specify the hourly - recurrence. - :vartype hourly_recurrence: ~azure.mgmt.devtestlabs.models.HourDetails - :ivar time_zone_id: The time zone ID (e.g. Pacific Standard time). - :vartype time_zone_id: str - :ivar notification_settings: Notification settings. - :vartype notification_settings: ~azure.mgmt.devtestlabs.models.NotificationSettings - :ivar target_resource_id: The resource ID to which the schedule belongs. - :vartype target_resource_id: str - """ - - _validation = { - "location": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "status": {"key": "properties.status", "type": "str"}, - "task_type": {"key": "properties.taskType", "type": "str"}, - "weekly_recurrence": {"key": "properties.weeklyRecurrence", "type": "WeekDetails"}, - "daily_recurrence": {"key": "properties.dailyRecurrence", "type": "DayDetails"}, - "hourly_recurrence": {"key": "properties.hourlyRecurrence", "type": "HourDetails"}, - "time_zone_id": {"key": "properties.timeZoneId", "type": "str"}, - "notification_settings": {"key": "properties.notificationSettings", "type": "NotificationSettings"}, - "target_resource_id": {"key": "properties.targetResourceId", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "external_service_fabric_id": {"key": "properties.externalServiceFabricId", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "provisioning_state_properties_provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier_properties_unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "id_properties_applicable_schedule_id": {"key": "properties.applicableSchedule.id", "type": "str"}, + "name_properties_applicable_schedule_name": {"key": "properties.applicableSchedule.name", "type": "str"}, + "type_properties_applicable_schedule_type": {"key": "properties.applicableSchedule.type", "type": "str"}, + "tags_properties_applicable_schedule_tags": {"key": "properties.applicableSchedule.tags", "type": "{str}"}, + "location_properties_applicable_schedule_location": { + "key": "properties.applicableSchedule.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_system_data": { + "key": "properties.applicableSchedule.systemData", + "type": "SystemData", + }, + "id_properties_applicable_schedule_properties_lab_vms_startup_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.id", + "type": "str", + }, + "name_properties_applicable_schedule_properties_lab_vms_startup_name": { + "key": "properties.applicableSchedule.properties.labVmsStartup.name", + "type": "str", + }, + "type_properties_applicable_schedule_properties_lab_vms_startup_type": { + "key": "properties.applicableSchedule.properties.labVmsStartup.type", + "type": "str", + }, + "tags_properties_applicable_schedule_properties_lab_vms_startup_tags": { + "key": "properties.applicableSchedule.properties.labVmsStartup.tags", + "type": "{str}", + }, + "location_properties_applicable_schedule_properties_lab_vms_startup_location": { + "key": "properties.applicableSchedule.properties.labVmsStartup.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data": { + "key": "properties.applicableSchedule.properties.labVmsStartup.systemData", + "type": "SystemData", + }, + "status_properties_applicable_schedule_properties_lab_vms_startup_properties_status": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.status", + "type": "str", + }, + "task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsStartup.properties.weeklyRecurrence.time", + "type": "str", + }, + "id_properties_applicable_schedule_properties_lab_vms_shutdown_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.id", + "type": "str", + }, + "name_properties_applicable_schedule_properties_lab_vms_shutdown_name": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.name", + "type": "str", + }, + "type_properties_applicable_schedule_properties_lab_vms_shutdown_type": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.type", + "type": "str", + }, + "tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.tags", + "type": "{str}", + }, + "location_properties_applicable_schedule_properties_lab_vms_shutdown_location": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.location", + "type": "str", + }, + "system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.systemData", + "type": "SystemData", + }, + "status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.status", + "type": "str", + }, + "task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.taskType", + "type": "str", + }, + "time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.timeZoneId", + "type": "str", + }, + "created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.createdDate", + "type": "iso-8601", + }, + "target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.targetResourceId", + "type": "str", + }, + "provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.provisioningState", + "type": "str", + }, + "unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.uniqueIdentifier", + "type": "str", + }, + "status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.status", + "type": "str", + }, + "time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.timeInMinutes", + "type": "int", + }, + "webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.webhookUrl", + "type": "str", + }, + "email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.emailRecipient", + "type": "str", + }, + "notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.notificationSettings.notificationLocale", + "type": "str", + }, + "minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.hourlyRecurrence.minute", + "type": "int", + }, + "time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.dailyRecurrence.time", + "type": "str", + }, + "weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.weeklyRecurrence.weekdays", + "type": "[str]", + }, + "time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time": { + "key": "properties.applicableSchedule.properties.labVmsShutdown.properties.weeklyRecurrence.time", + "type": "str", + }, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - name: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - status: Optional[Union[str, "_models.EnableStatus"]] = None, - task_type: Optional[str] = None, - weekly_recurrence: Optional["_models.WeekDetails"] = None, - daily_recurrence: Optional["_models.DayDetails"] = None, - hourly_recurrence: Optional["_models.HourDetails"] = None, - time_zone_id: Optional[str] = None, - notification_settings: Optional["_models.NotificationSettings"] = None, - target_resource_id: Optional[str] = None, - **kwargs - ): - """ - :keyword name: The name of the virtual machine or environment. - :paramtype name: str - :keyword tags: The tags of the resource. + external_service_fabric_id: Optional[str] = None, + environment_id: Optional[str] = None, + tags_properties_applicable_schedule_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_location: Optional[str] = None, + tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_properties_lab_vms_startup_location: Optional[str] = None, + status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: Optional[str] = None, + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: Optional[ + str + ] = None, + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: Optional[ + str + ] = None, + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: Optional[ + str + ] = None, + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: Optional[ + int + ] = None, + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: Optional[ + str + ] = None, + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: Optional[ + List[str] + ] = None, + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: Optional[ + str + ] = None, + tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Optional[Dict[str, str]] = None, + location_properties_applicable_schedule_properties_lab_vms_shutdown_location: Optional[str] = None, + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: Optional[str] = None, + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: Optional[ + str + ] = None, + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: Optional[ + str + ] = None, + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: Optional[ + Union[str, "_models.EnableStatus"] + ] = None, + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: Optional[ + int + ] = None, + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: Optional[ + str + ] = None, + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: Optional[ + str + ] = None, + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: Optional[ + str + ] = None, + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: Optional[ + int + ] = None, + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: Optional[ + str + ] = None, + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: Optional[ + List[str] + ] = None, + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: Optional[ + str + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword status: The status of the schedule (i.e. Enabled, Disabled). Known values are: + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword external_service_fabric_id: The backing service fabric resource's id. + :paramtype external_service_fabric_id: str + :keyword environment_id: The resource id of the environment under which the service fabric + resource is present. + :paramtype environment_id: str + :keyword tags_properties_applicable_schedule_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_tags: dict[str, str] + :keyword location_properties_applicable_schedule_location: The geo-location where the resource + lives. + :paramtype location_properties_applicable_schedule_location: str + :keyword tags_properties_applicable_schedule_properties_lab_vms_startup_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_properties_lab_vms_startup_tags: dict[str, str] + :keyword location_properties_applicable_schedule_properties_lab_vms_startup_location: The + geo-location where the resource lives. + :paramtype location_properties_applicable_schedule_properties_lab_vms_startup_location: str + :keyword status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :paramtype status_properties_applicable_schedule_properties_lab_vms_startup_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type: str + :keyword + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :paramtype + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id: + str + :keyword + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + The resource ID to which the schedule belongs. + :paramtype + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id: + str + :keyword + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and "Disabled". - :paramtype status: str or ~azure.mgmt.devtestlabs.models.EnableStatus - :keyword task_type: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - :paramtype task_type: str - :keyword weekly_recurrence: If the schedule will occur only some days of the week, specify the - weekly recurrence. - :paramtype weekly_recurrence: ~azure.mgmt.devtestlabs.models.WeekDetails - :keyword daily_recurrence: If the schedule will occur once each day of the week, specify the - daily recurrence. - :paramtype daily_recurrence: ~azure.mgmt.devtestlabs.models.DayDetails - :keyword hourly_recurrence: If the schedule will occur multiple times a day, specify the hourly - recurrence. - :paramtype hourly_recurrence: ~azure.mgmt.devtestlabs.models.HourDetails - :keyword time_zone_id: The time zone ID (e.g. Pacific Standard time). - :paramtype time_zone_id: str - :keyword notification_settings: Notification settings. - :paramtype notification_settings: ~azure.mgmt.devtestlabs.models.NotificationSettings - :keyword target_resource_id: The resource ID to which the schedule belongs. - :paramtype target_resource_id: str - """ - super().__init__(**kwargs) - self.name = name - self.location = None - self.tags = tags - self.status = status - self.task_type = task_type - self.weekly_recurrence = weekly_recurrence - self.daily_recurrence = daily_recurrence - self.hourly_recurrence = hourly_recurrence - self.time_zone_id = time_zone_id - self.notification_settings = notification_settings - self.target_resource_id = target_resource_id + :paramtype + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes: + int + :keyword + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale: + str + :keyword + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :paramtype + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute: + int + :keyword + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + The time of day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time: + str + :keyword + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays: + list[str] + :keyword + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time: + str + :keyword tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: Resource tags. + :paramtype tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags: dict[str, str] + :keyword location_properties_applicable_schedule_properties_lab_vms_shutdown_location: The + geo-location where the resource lives. + :paramtype location_properties_applicable_schedule_properties_lab_vms_shutdown_location: str + :keyword status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + The status of the schedule (i.e. Enabled, Disabled). Known values are: "Enabled" and + "Disabled". + :paramtype status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: The + task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + :paramtype + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type: str + :keyword + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + The time zone ID (e.g. Pacific Standard time). + :paramtype + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id: + str + :keyword + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + The resource ID to which the schedule belongs. + :paramtype + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id: + str + :keyword + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + If notifications are enabled for this schedule (i.e. Enabled, Disabled). Known values are: + "Enabled" and "Disabled". + :paramtype + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status: + str or ~azure.mgmt.devtestlabs.models.EnableStatus + :keyword + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + Time in minutes before event at which notification will be sent. + :paramtype + time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes: + int + :keyword + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + The webhook URL to which the notification will be sent. + :paramtype + webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url: + str + :keyword + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + The email recipient to send notifications to (can be a list of semi-colon separated email + addresses). + :paramtype + email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient: + str + :keyword + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + The locale to use when sending a notification (fallback for unsupported languages is EN). + :paramtype + notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale: + str + :keyword + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + Minutes of the hour the schedule will run. + :paramtype + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute: + int + :keyword + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + The time of day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time: + str + :keyword + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + :paramtype + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays: + list[str] + :keyword + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + The time of the day the schedule will occur. + :paramtype + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time: + str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.external_service_fabric_id = external_service_fabric_id + self.environment_id = environment_id + self.provisioning_state_properties_provisioning_state = None + self.unique_identifier_properties_unique_identifier = None + self.id_properties_applicable_schedule_id = None + self.name_properties_applicable_schedule_name = None + self.type_properties_applicable_schedule_type = None + self.tags_properties_applicable_schedule_tags = tags_properties_applicable_schedule_tags + self.location_properties_applicable_schedule_location = location_properties_applicable_schedule_location + self.system_data_properties_applicable_schedule_system_data = None + self.id_properties_applicable_schedule_properties_lab_vms_startup_id = None + self.name_properties_applicable_schedule_properties_lab_vms_startup_name = None + self.type_properties_applicable_schedule_properties_lab_vms_startup_type = None + self.tags_properties_applicable_schedule_properties_lab_vms_startup_tags = ( + tags_properties_applicable_schedule_properties_lab_vms_startup_tags + ) + self.location_properties_applicable_schedule_properties_lab_vms_startup_location = ( + location_properties_applicable_schedule_properties_lab_vms_startup_location + ) + self.system_data_properties_applicable_schedule_properties_lab_vms_startup_system_data = None + self.status_properties_applicable_schedule_properties_lab_vms_startup_properties_status = ( + status_properties_applicable_schedule_properties_lab_vms_startup_properties_status + ) + self.task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type = ( + task_type_properties_applicable_schedule_properties_lab_vms_startup_properties_task_type + ) + self.time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id = ( + time_zone_id_properties_applicable_schedule_properties_lab_vms_startup_properties_time_zone_id + ) + self.created_date_properties_applicable_schedule_properties_lab_vms_startup_properties_created_date = None + self.target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id = ( + target_resource_id_properties_applicable_schedule_properties_lab_vms_startup_properties_target_resource_id + ) + self.provisioning_state_properties_applicable_schedule_properties_lab_vms_startup_properties_provisioning_state = ( + None + ) + self.unique_identifier_properties_applicable_schedule_properties_lab_vms_startup_properties_unique_identifier = ( + None + ) + self.status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status = ( + status_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_status + ) + self.time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes = time_in_minutes_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_time_in_minutes + self.webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url = webhook_url_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_webhook_url + self.email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient = email_recipient_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_email_recipient + self.notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale = notification_locale_properties_applicable_schedule_properties_lab_vms_startup_properties_notification_settings_notification_locale + self.minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute = ( + minute_properties_applicable_schedule_properties_lab_vms_startup_properties_hourly_recurrence_minute + ) + self.time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_startup_properties_daily_recurrence_time + ) + self.weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays = ( + weekdays_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_weekdays + ) + self.time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_startup_properties_weekly_recurrence_time + ) + self.id_properties_applicable_schedule_properties_lab_vms_shutdown_id = None + self.name_properties_applicable_schedule_properties_lab_vms_shutdown_name = None + self.type_properties_applicable_schedule_properties_lab_vms_shutdown_type = None + self.tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags = ( + tags_properties_applicable_schedule_properties_lab_vms_shutdown_tags + ) + self.location_properties_applicable_schedule_properties_lab_vms_shutdown_location = ( + location_properties_applicable_schedule_properties_lab_vms_shutdown_location + ) + self.system_data_properties_applicable_schedule_properties_lab_vms_shutdown_system_data = None + self.status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status = ( + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_status + ) + self.task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type = ( + task_type_properties_applicable_schedule_properties_lab_vms_shutdown_properties_task_type + ) + self.time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id = ( + time_zone_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_time_zone_id + ) + self.created_date_properties_applicable_schedule_properties_lab_vms_shutdown_properties_created_date = None + self.target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id = ( + target_resource_id_properties_applicable_schedule_properties_lab_vms_shutdown_properties_target_resource_id + ) + self.provisioning_state_properties_applicable_schedule_properties_lab_vms_shutdown_properties_provisioning_state = ( + None + ) + self.unique_identifier_properties_applicable_schedule_properties_lab_vms_shutdown_properties_unique_identifier = ( + None + ) + self.status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status = ( + status_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_status + ) + self.time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes = time_in_minutes_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_time_in_minutes + self.webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url = webhook_url_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_webhook_url + self.email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient = email_recipient_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_email_recipient + self.notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale = notification_locale_properties_applicable_schedule_properties_lab_vms_shutdown_properties_notification_settings_notification_locale + self.minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute = ( + minute_properties_applicable_schedule_properties_lab_vms_shutdown_properties_hourly_recurrence_minute + ) + self.time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_daily_recurrence_time + ) + self.weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays = ( + weekdays_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_weekdays + ) + self.time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time = ( + time_properties_applicable_schedule_properties_lab_vms_shutdown_properties_weekly_recurrence_time + ) -class ScheduleFragment(UpdateResource): - """A schedule. +class ServiceFabricFragment(UpdateResource): + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) -class ScheduleList(_serialization.Model): - """The response of a list operation. +class ServiceFabricList(_serialization.Model): + """Contains a list of serviceFabrics and their properties. - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.Schedule] - :ivar next_link: Link for next set of results. + :ivar value: List of serviceFabrics and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.ServiceFabric] + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Schedule]"}, + "value": {"key": "value", "type": "[ServiceFabric]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Schedule"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.ServiceFabric"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.Schedule] - :keyword next_link: Link for next set of results. + :keyword value: List of serviceFabrics and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.ServiceFabric] + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -5036,23 +10279,32 @@ def __init__(self, *, value: Optional[List["_models.Schedule"]] = None, next_lin self.next_link = next_link -class Secret(Resource): - """A secret. +class ServiceRunner(Resource): + """A container for a managed identity to execute DevTest lab services. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar value: The value of the secret for secret creation. - :vartype value: str + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar identity_usage_type: The purpose of bringing the identity to the lab. Ex: To use during + Environment creation or to deploy on the VMs. + :vartype identity_usage_type: str :ivar provisioning_state: The provisioning status of the resource. :vartype provisioning_state: str :ivar unique_identifier: The unique immutable identifier of a resource (Guid). @@ -5063,6 +10315,8 @@ class Secret(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, } @@ -5071,9 +10325,11 @@ class Secret(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "value": {"key": "properties.value", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "identity_usage_type": {"key": "properties.identityUsageType", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, } @@ -5081,63 +10337,52 @@ class Secret(Resource): def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - value: Optional[str] = None, - **kwargs - ): + identity: Optional["_models.IdentityProperties"] = None, + identity_usage_type: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword value: The value of the secret for secret creation. - :paramtype value: str + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword identity_usage_type: The purpose of bringing the identity to the lab. Ex: To use + during Environment creation or to deploy on the VMs. + :paramtype identity_usage_type: str """ - super().__init__(location=location, tags=tags, **kwargs) - self.value = value + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.system_data = None + self.identity_usage_type = identity_usage_type self.provisioning_state = None self.unique_identifier = None -class SecretFragment(UpdateResource): - """A secret. - - :ivar tags: The tags of the resource. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - """ - super().__init__(tags=tags, **kwargs) - - -class SecretList(_serialization.Model): - """The response of a list operation. +class ServiceRunnerList(_serialization.Model): + """Contains a list of serviceRunners and their properties. - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.Secret] - :ivar next_link: Link for next set of results. + :ivar value: List of serviceRunners and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.ServiceRunner] + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, + "value": {"key": "value", "type": "[ServiceRunner]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.ServiceRunner"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.Secret] - :keyword next_link: Link for next set of results. + :keyword value: List of serviceRunners and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.ServiceRunner] + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -5145,28 +10390,33 @@ def __init__(self, *, value: Optional[List["_models.Secret"]] = None, next_link: self.next_link = next_link -class ServiceFabric(Resource): - """A Service Fabric. +class SharedGallery(Resource): + """Properties of a shared gallery. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar external_service_fabric_id: The backing service fabric resource's id. - :vartype external_service_fabric_id: str - :ivar environment_id: The resource id of the environment under which the service fabric - resource is present. - :vartype environment_id: str - :ivar applicable_schedule: The applicable schedule for the virtual machine. - :vartype applicable_schedule: ~azure.mgmt.devtestlabs.models.ApplicableSchedule + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar gallery_id: The shared image gallery resource Id. + :vartype gallery_id: str + :ivar allow_all_images: Enables all images in the gallery to be available in the lab for VM + creation. This will override the EnableState on shared images. Known values are: "Disabled" and + "Enabled". + :vartype allow_all_images: str or ~azure.mgmt.devtestlabs.models.EnableState :ivar provisioning_state: The provisioning status of the resource. :vartype provisioning_state: str :ivar unique_identifier: The unique immutable identifier of a resource (Guid). @@ -5177,7 +10427,8 @@ class ServiceFabric(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "applicable_schedule": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, } @@ -5186,11 +10437,11 @@ class ServiceFabric(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "external_service_fabric_id": {"key": "properties.externalServiceFabricId", "type": "str"}, - "environment_id": {"key": "properties.environmentId", "type": "str"}, - "applicable_schedule": {"key": "properties.applicableSchedule", "type": "ApplicableSchedule"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "gallery_id": {"key": "properties.galleryId", "type": "str"}, + "allow_all_images": {"key": "properties.allowAllImages", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, } @@ -5198,71 +10449,83 @@ class ServiceFabric(Resource): def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - external_service_fabric_id: Optional[str] = None, - environment_id: Optional[str] = None, - **kwargs - ): + gallery_id: Optional[str] = None, + allow_all_images: Optional[Union[str, "_models.EnableState"]] = None, + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword external_service_fabric_id: The backing service fabric resource's id. - :paramtype external_service_fabric_id: str - :keyword environment_id: The resource id of the environment under which the service fabric - resource is present. - :paramtype environment_id: str - """ - super().__init__(location=location, tags=tags, **kwargs) - self.external_service_fabric_id = external_service_fabric_id - self.environment_id = environment_id - self.applicable_schedule = None + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword gallery_id: The shared image gallery resource Id. + :paramtype gallery_id: str + :keyword allow_all_images: Enables all images in the gallery to be available in the lab for VM + creation. This will override the EnableState on shared images. Known values are: "Disabled" and + "Enabled". + :paramtype allow_all_images: str or ~azure.mgmt.devtestlabs.models.EnableState + """ + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.gallery_id = gallery_id + self.allow_all_images = allow_all_images self.provisioning_state = None self.unique_identifier = None -class ServiceFabricFragment(UpdateResource): - """A Service Fabric. +class SharedGalleryFragment(UpdateResource): + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) -class ServiceFabricList(_serialization.Model): - """The response of a list operation. +class SharedGalleryList(_serialization.Model): + """Contains a list of sharedGalleries and their properties. - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.ServiceFabric] - :ivar next_link: Link for next set of results. + :ivar value: List of sharedGalleries and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.SharedGallery] + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[ServiceFabric]"}, + "value": {"key": "value", "type": "[SharedGallery]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.ServiceFabric"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.SharedGallery"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.ServiceFabric] - :keyword next_link: Link for next set of results. + :keyword value: List of sharedGalleries and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.SharedGallery] + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -5270,36 +10533,129 @@ def __init__( self.next_link = next_link -class ServiceRunner(Resource): - """A container for a managed identity to execute DevTest lab services. +class SharedImage(Resource): # pylint: disable=too-many-instance-attributes + """Properties of a shared image. + + 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData + :ivar definition_name: Shared Image definition name in shared image gallery. + :vartype definition_name: str + :ivar os_type: The operating system of the image. Known values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.devtestlabs.models.OsType + :ivar image_type: The type of image in the gallery (generalized or specialized). Known values + are: "Generalized" and "Specialized". + :vartype image_type: str or ~azure.mgmt.devtestlabs.models.ImageType + :ivar enable_state: Whether or not the image is enabled. Known values are: "Disabled" and + "Enabled". + :vartype enable_state: str or ~azure.mgmt.devtestlabs.models.EnableState + :ivar display_name: Display name of the image. + :vartype display_name: str + :ivar versions: List of image versions in definition. + :vartype versions: list[~azure.mgmt.devtestlabs.models.ImageVersionProperties] + :ivar provisioning_state: The provisioning status of the resource. + :vartype provisioning_state: str + :ivar unique_identifier: The unique immutable identifier of a resource (Guid). + :vartype unique_identifier: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "unique_identifier": {"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"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "definition_name": {"key": "properties.definitionName", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "image_type": {"key": "properties.imageType", "type": "str"}, + "enable_state": {"key": "properties.enableState", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "versions": {"key": "properties.versions", "type": "[ImageVersionProperties]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + definition_name: Optional[str] = None, + os_type: Optional[Union[str, "_models.OsType"]] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, + enable_state: Optional[Union[str, "_models.EnableState"]] = None, + display_name: Optional[str] = None, + versions: Optional[List["_models.ImageVersionProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword definition_name: Shared Image definition name in shared image gallery. + :paramtype definition_name: str + :keyword os_type: The operating system of the image. Known values are: "Windows" and "Linux". + :paramtype os_type: str or ~azure.mgmt.devtestlabs.models.OsType + :keyword image_type: The type of image in the gallery (generalized or specialized). Known + values are: "Generalized" and "Specialized". + :paramtype image_type: str or ~azure.mgmt.devtestlabs.models.ImageType + :keyword enable_state: Whether or not the image is enabled. Known values are: "Disabled" and + "Enabled". + :paramtype enable_state: str or ~azure.mgmt.devtestlabs.models.EnableState + :keyword display_name: Display name of the image. + :paramtype display_name: str + :keyword versions: List of image versions in definition. + :paramtype versions: list[~azure.mgmt.devtestlabs.models.ImageVersionProperties] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.definition_name = definition_name + self.os_type = os_type + self.image_type = image_type + self.enable_state = enable_state + self.display_name = display_name + self.versions = versions + self.provisioning_state = None + self.unique_identifier = None + - Variables are only populated by the server, and will be ignored when sending a request. +class SharedImageFragment(UpdateResource): + """Patch. - :ivar id: The identifier of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar location: The location of the resource. - :vartype location: str :ivar tags: The tags of the resource. :vartype tags: dict[str, str] :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - _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"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "IdentityProperties"}, } @@ -5307,44 +10663,40 @@ class ServiceRunner(Resource): def __init__( self, *, - location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.IdentityProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(location=location, tags=tags, **kwargs) - self.identity = identity + super().__init__(tags=tags, identity=identity, **kwargs) -class ServiceRunnerList(_serialization.Model): - """The response of a list operation. +class SharedImageList(_serialization.Model): + """Contains a list of sharedImages and their properties. - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.ServiceRunner] - :ivar next_link: Link for next set of results. + :ivar value: List of sharedImages and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.SharedImage] + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[ServiceRunner]"}, + "value": {"key": "value", "type": "[SharedImage]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.ServiceRunner"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.SharedImage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.ServiceRunner] - :keyword next_link: Link for next set of results. + :keyword value: List of sharedImages and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.SharedImage] + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -5352,135 +10704,6 @@ def __init__( self.next_link = next_link -class SharedPublicIpAddressConfiguration(_serialization.Model): - """Properties of a virtual machine that determine how it is connected to a load balancer. - - :ivar inbound_nat_rules: The incoming NAT rules. - :vartype inbound_nat_rules: list[~azure.mgmt.devtestlabs.models.InboundNatRule] - """ - - _attribute_map = { - "inbound_nat_rules": {"key": "inboundNatRules", "type": "[InboundNatRule]"}, - } - - def __init__(self, *, inbound_nat_rules: Optional[List["_models.InboundNatRule"]] = None, **kwargs): - """ - :keyword inbound_nat_rules: The incoming NAT rules. - :paramtype inbound_nat_rules: list[~azure.mgmt.devtestlabs.models.InboundNatRule] - """ - super().__init__(**kwargs) - self.inbound_nat_rules = inbound_nat_rules - - -class ShutdownNotificationContent(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The contents of a shutdown notification. Webhooks can use this type to deserialize the request body when they get notified of an imminent shutdown. - - :ivar skip_url: The URL to skip auto-shutdown. - :vartype skip_url: str - :ivar delay_url60: The URL to delay shutdown by 60 minutes. - :vartype delay_url60: str - :ivar delay_url120: The URL to delay shutdown by 2 hours. - :vartype delay_url120: str - :ivar vm_name: The virtual machine to be shut down. - :vartype vm_name: str - :ivar guid: The GUID for the virtual machine to be shut down. - :vartype guid: str - :ivar owner: The owner of the virtual machine. - :vartype owner: str - :ivar vm_url: The URL of the virtual machine. - :vartype vm_url: str - :ivar minutes_until_shutdown: Minutes remaining until shutdown. - :vartype minutes_until_shutdown: str - :ivar event_type: The event for which a notification will be sent. - :vartype event_type: str - :ivar text: The text for the notification. - :vartype text: str - :ivar subscription_id: The subscription ID for the schedule. - :vartype subscription_id: str - :ivar resource_group_name: The resource group name for the schedule. - :vartype resource_group_name: str - :ivar lab_name: The lab for the schedule. - :vartype lab_name: str - """ - - _attribute_map = { - "skip_url": {"key": "skipUrl", "type": "str"}, - "delay_url60": {"key": "delayUrl60", "type": "str"}, - "delay_url120": {"key": "delayUrl120", "type": "str"}, - "vm_name": {"key": "vmName", "type": "str"}, - "guid": {"key": "guid", "type": "str"}, - "owner": {"key": "owner", "type": "str"}, - "vm_url": {"key": "vmUrl", "type": "str"}, - "minutes_until_shutdown": {"key": "minutesUntilShutdown", "type": "str"}, - "event_type": {"key": "eventType", "type": "str"}, - "text": {"key": "text", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "resource_group_name": {"key": "resourceGroupName", "type": "str"}, - "lab_name": {"key": "labName", "type": "str"}, - } - - def __init__( - self, - *, - skip_url: Optional[str] = None, - delay_url60: Optional[str] = None, - delay_url120: Optional[str] = None, - vm_name: Optional[str] = None, - guid: Optional[str] = None, - owner: Optional[str] = None, - vm_url: Optional[str] = None, - minutes_until_shutdown: Optional[str] = None, - event_type: Optional[str] = None, - text: Optional[str] = None, - subscription_id: Optional[str] = None, - resource_group_name: Optional[str] = None, - lab_name: Optional[str] = None, - **kwargs - ): - """ - :keyword skip_url: The URL to skip auto-shutdown. - :paramtype skip_url: str - :keyword delay_url60: The URL to delay shutdown by 60 minutes. - :paramtype delay_url60: str - :keyword delay_url120: The URL to delay shutdown by 2 hours. - :paramtype delay_url120: str - :keyword vm_name: The virtual machine to be shut down. - :paramtype vm_name: str - :keyword guid: The GUID for the virtual machine to be shut down. - :paramtype guid: str - :keyword owner: The owner of the virtual machine. - :paramtype owner: str - :keyword vm_url: The URL of the virtual machine. - :paramtype vm_url: str - :keyword minutes_until_shutdown: Minutes remaining until shutdown. - :paramtype minutes_until_shutdown: str - :keyword event_type: The event for which a notification will be sent. - :paramtype event_type: str - :keyword text: The text for the notification. - :paramtype text: str - :keyword subscription_id: The subscription ID for the schedule. - :paramtype subscription_id: str - :keyword resource_group_name: The resource group name for the schedule. - :paramtype resource_group_name: str - :keyword lab_name: The lab for the schedule. - :paramtype lab_name: str - """ - super().__init__(**kwargs) - self.skip_url = skip_url - self.delay_url60 = delay_url60 - self.delay_url120 = delay_url120 - self.vm_name = vm_name - self.guid = guid - self.owner = owner - self.vm_url = vm_url - self.minutes_until_shutdown = minutes_until_shutdown - self.event_type = event_type - self.text = text - self.subscription_id = subscription_id - self.resource_group_name = resource_group_name - self.lab_name = lab_name - - class Subnet(_serialization.Model): """Subnet information. @@ -5505,8 +10728,8 @@ def __init__( resource_id: Optional[str] = None, lab_subnet_name: Optional[str] = None, allow_public_ip: Optional[Union[str, "_models.UsagePermissionType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: The resource ID of the subnet. :paramtype resource_id: str @@ -5538,12 +10761,10 @@ class SubnetOverride(_serialization.Model): "Allow". :vartype use_public_ip_address_permission: str or ~azure.mgmt.devtestlabs.models.UsagePermissionType - :ivar shared_public_ip_address_configuration: Properties that virtual machines on this subnet - will share. - :vartype shared_public_ip_address_configuration: - ~azure.mgmt.devtestlabs.models.SubnetSharedPublicIpAddressConfiguration :ivar virtual_network_pool_name: The virtual network pool associated with this subnet. :vartype virtual_network_pool_name: str + :ivar allowed_ports: Backend ports that virtual machines on this subnet are allowed to expose. + :vartype allowed_ports: list[~azure.mgmt.devtestlabs.models.Port] """ _attribute_map = { @@ -5551,11 +10772,8 @@ class SubnetOverride(_serialization.Model): "lab_subnet_name": {"key": "labSubnetName", "type": "str"}, "use_in_vm_creation_permission": {"key": "useInVmCreationPermission", "type": "str"}, "use_public_ip_address_permission": {"key": "usePublicIpAddressPermission", "type": "str"}, - "shared_public_ip_address_configuration": { - "key": "sharedPublicIpAddressConfiguration", - "type": "SubnetSharedPublicIpAddressConfiguration", - }, "virtual_network_pool_name": {"key": "virtualNetworkPoolName", "type": "str"}, + "allowed_ports": {"key": "sharedPublicIpAddressConfiguration.allowedPorts", "type": "[Port]"}, } def __init__( @@ -5565,10 +10783,10 @@ def __init__( lab_subnet_name: Optional[str] = None, use_in_vm_creation_permission: Optional[Union[str, "_models.UsagePermissionType"]] = None, use_public_ip_address_permission: Optional[Union[str, "_models.UsagePermissionType"]] = None, - shared_public_ip_address_configuration: Optional["_models.SubnetSharedPublicIpAddressConfiguration"] = None, virtual_network_pool_name: Optional[str] = None, - **kwargs - ): + allowed_ports: Optional[List["_models.Port"]] = None, + **kwargs: Any + ) -> None: """ :keyword resource_id: The resource ID of the subnet. :paramtype resource_id: str @@ -5583,134 +10801,164 @@ def __init__( "Deny", and "Allow". :paramtype use_public_ip_address_permission: str or ~azure.mgmt.devtestlabs.models.UsagePermissionType - :keyword shared_public_ip_address_configuration: Properties that virtual machines on this - subnet will share. - :paramtype shared_public_ip_address_configuration: - ~azure.mgmt.devtestlabs.models.SubnetSharedPublicIpAddressConfiguration :keyword virtual_network_pool_name: The virtual network pool associated with this subnet. :paramtype virtual_network_pool_name: str + :keyword allowed_ports: Backend ports that virtual machines on this subnet are allowed to + expose. + :paramtype allowed_ports: list[~azure.mgmt.devtestlabs.models.Port] """ super().__init__(**kwargs) self.resource_id = resource_id self.lab_subnet_name = lab_subnet_name self.use_in_vm_creation_permission = use_in_vm_creation_permission self.use_public_ip_address_permission = use_public_ip_address_permission - self.shared_public_ip_address_configuration = shared_public_ip_address_configuration self.virtual_network_pool_name = virtual_network_pool_name + self.allowed_ports = allowed_ports -class SubnetSharedPublicIpAddressConfiguration(_serialization.Model): - """Configuration for public IP address sharing. +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. - :ivar allowed_ports: Backend ports that virtual machines on this subnet are allowed to expose. - :vartype allowed_ports: list[~azure.mgmt.devtestlabs.models.Port] + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.devtestlabs.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.devtestlabs.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { - "allowed_ports": {"key": "allowedPorts", "type": "[Port]"}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } - def __init__(self, *, allowed_ports: Optional[List["_models.Port"]] = None, **kwargs): - """ - :keyword allowed_ports: Backend ports that virtual machines on this subnet are allowed to - expose. - :paramtype allowed_ports: list[~azure.mgmt.devtestlabs.models.Port] + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.devtestlabs.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.devtestlabs.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime """ super().__init__(**kwargs) - self.allowed_ports = allowed_ports + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at -class TargetCostProperties(_serialization.Model): - """Properties of a cost target. - - :ivar status: Target cost status. Known values are: "Enabled" and "Disabled". - :vartype status: str or ~azure.mgmt.devtestlabs.models.TargetCostStatus - :ivar target: Lab target cost. - :vartype target: int - :ivar cost_thresholds: Cost thresholds. - :vartype cost_thresholds: list[~azure.mgmt.devtestlabs.models.CostThresholdProperties] - :ivar cycle_start_date_time: Reporting cycle start date. - :vartype cycle_start_date_time: ~datetime.datetime - :ivar cycle_end_date_time: Reporting cycle end date. - :vartype cycle_end_date_time: ~datetime.datetime - :ivar cycle_type: Reporting cycle type. Known values are: "CalendarMonth" and "Custom". - :vartype cycle_type: str or ~azure.mgmt.devtestlabs.models.ReportingCycleType +class UefiSettings(_serialization.Model): + """Security settings like secure boot and vTPM. + + :ivar secure_boot_enabled: Flag to enable or disable secure boot. + :vartype secure_boot_enabled: bool + :ivar v_tpm_enabled: Flag to enable or disable vTPM (virtual Trusted Platform Module). + :vartype v_tpm_enabled: bool """ _attribute_map = { - "status": {"key": "status", "type": "str"}, - "target": {"key": "target", "type": "int"}, - "cost_thresholds": {"key": "costThresholds", "type": "[CostThresholdProperties]"}, - "cycle_start_date_time": {"key": "cycleStartDateTime", "type": "iso-8601"}, - "cycle_end_date_time": {"key": "cycleEndDateTime", "type": "iso-8601"}, - "cycle_type": {"key": "cycleType", "type": "str"}, + "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, + "v_tpm_enabled": {"key": "vTpmEnabled", "type": "bool"}, } def __init__( - self, - *, - status: Optional[Union[str, "_models.TargetCostStatus"]] = None, - target: Optional[int] = None, - cost_thresholds: Optional[List["_models.CostThresholdProperties"]] = None, - cycle_start_date_time: Optional[datetime.datetime] = None, - cycle_end_date_time: Optional[datetime.datetime] = None, - cycle_type: Optional[Union[str, "_models.ReportingCycleType"]] = None, - **kwargs - ): - """ - :keyword status: Target cost status. Known values are: "Enabled" and "Disabled". - :paramtype status: str or ~azure.mgmt.devtestlabs.models.TargetCostStatus - :keyword target: Lab target cost. - :paramtype target: int - :keyword cost_thresholds: Cost thresholds. - :paramtype cost_thresholds: list[~azure.mgmt.devtestlabs.models.CostThresholdProperties] - :keyword cycle_start_date_time: Reporting cycle start date. - :paramtype cycle_start_date_time: ~datetime.datetime - :keyword cycle_end_date_time: Reporting cycle end date. - :paramtype cycle_end_date_time: ~datetime.datetime - :keyword cycle_type: Reporting cycle type. Known values are: "CalendarMonth" and "Custom". - :paramtype cycle_type: str or ~azure.mgmt.devtestlabs.models.ReportingCycleType + self, *, secure_boot_enabled: Optional[bool] = None, v_tpm_enabled: Optional[bool] = None, **kwargs: Any + ) -> None: + """ + :keyword secure_boot_enabled: Flag to enable or disable secure boot. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Flag to enable or disable vTPM (virtual Trusted Platform Module). + :paramtype v_tpm_enabled: bool """ super().__init__(**kwargs) - self.status = status - self.target = target - self.cost_thresholds = cost_thresholds - self.cycle_start_date_time = cycle_start_date_time - self.cycle_end_date_time = cycle_end_date_time - self.cycle_type = cycle_type + self.secure_boot_enabled = secure_boot_enabled + self.v_tpm_enabled = v_tpm_enabled -class User(Resource): +class User(Resource): # pylint: disable=too-many-instance-attributes """Profile of a lab user. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar identity: The identity of the user. - :vartype identity: ~azure.mgmt.devtestlabs.models.UserIdentity - :ivar secret_store: The secret store of the user. - :vartype secret_store: ~azure.mgmt.devtestlabs.models.UserSecretStore + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar created_date: The creation date of the user profile. :vartype created_date: ~datetime.datetime :ivar provisioning_state: The provisioning status of the resource. :vartype provisioning_state: str :ivar unique_identifier: The unique immutable identifier of a resource (Guid). :vartype unique_identifier: str + :ivar key_vault_uri: The URI of the user's Key vault. + :vartype key_vault_uri: str + :ivar key_vault_id: The ID of the user's Key vault. + :vartype key_vault_id: str + :ivar principal_name: Set to the principal name / UPN of the client JWT making the request. + :vartype principal_name: str + :ivar principal_id: Set to the principal Id of the client JWT making the request. Service + principal will not have the principal Id. + :vartype principal_id: str + :ivar tenant_id: Set to the tenant ID of the client JWT making the request. + :vartype tenant_id: str + :ivar object_id: Set to the object Id of the client JWT making the request. Not all users have + object Id. For CSP (reseller) scenarios for example, object Id is not available. + :vartype object_id: str + :ivar app_id: Set to the app Id of the client JWT making the request. + :vartype app_id: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "created_date": {"readonly": True}, "provisioning_state": {"readonly": True}, "unique_identifier": {"readonly": True}, @@ -5720,97 +10968,44 @@ class User(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "properties.identity", "type": "UserIdentity"}, - "secret_store": {"key": "properties.secretStore", "type": "UserSecretStore"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "unique_identifier": {"key": "properties.uniqueIdentifier", "type": "str"}, + "key_vault_uri": {"key": "properties.secretStore.keyVaultUri", "type": "str"}, + "key_vault_id": {"key": "properties.secretStore.keyVaultId", "type": "str"}, + "principal_name": {"key": "properties.identity.principalName", "type": "str"}, + "principal_id": {"key": "properties.identity.principalId", "type": "str"}, + "tenant_id": {"key": "properties.identity.tenantId", "type": "str"}, + "object_id": {"key": "properties.identity.objectId", "type": "str"}, + "app_id": {"key": "properties.identity.appId", "type": "str"}, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.UserIdentity"] = None, - secret_store: Optional["_models.UserSecretStore"] = None, - **kwargs - ): - """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - :keyword identity: The identity of the user. - :paramtype identity: ~azure.mgmt.devtestlabs.models.UserIdentity - :keyword secret_store: The secret store of the user. - :paramtype secret_store: ~azure.mgmt.devtestlabs.models.UserSecretStore - """ - super().__init__(location=location, tags=tags, **kwargs) - self.identity = identity - self.secret_store = secret_store - self.created_date = None - self.provisioning_state = None - self.unique_identifier = None - - -class UserFragment(UpdateResource): - """Profile of a lab user. - - :ivar tags: The tags of the resource. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - """ - super().__init__(tags=tags, **kwargs) - - -class UserIdentity(_serialization.Model): - """Identity attributes of a lab user. - - :ivar principal_name: Set to the principal name / UPN of the client JWT making the request. - :vartype principal_name: str - :ivar principal_id: Set to the principal Id of the client JWT making the request. Service - principal will not have the principal Id. - :vartype principal_id: str - :ivar tenant_id: Set to the tenant ID of the client JWT making the request. - :vartype tenant_id: str - :ivar object_id: Set to the object Id of the client JWT making the request. Not all users have - object Id. For CSP (reseller) scenarios for example, object Id is not available. - :vartype object_id: str - :ivar app_id: Set to the app Id of the client JWT making the request. - :vartype app_id: str - """ - - _attribute_map = { - "principal_name": {"key": "principalName", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, - "app_id": {"key": "appId", "type": "str"}, - } - - def __init__( - self, - *, + key_vault_uri: Optional[str] = None, + key_vault_id: Optional[str] = None, principal_name: Optional[str] = None, principal_id: Optional[str] = None, tenant_id: Optional[str] = None, object_id: Optional[str] = None, app_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword key_vault_uri: The URI of the user's Key vault. + :paramtype key_vault_uri: str + :keyword key_vault_id: The ID of the user's Key vault. + :paramtype key_vault_id: str :keyword principal_name: Set to the principal name / UPN of the client JWT making the request. :paramtype principal_name: str :keyword principal_id: Set to the principal Id of the client JWT making the request. Service @@ -5824,7 +11019,13 @@ def __init__( :keyword app_id: Set to the app Id of the client JWT making the request. :paramtype app_id: str """ - super().__init__(**kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.created_date = None + self.provisioning_state = None + self.unique_identifier = None + self.key_vault_uri = key_vault_uri + self.key_vault_id = key_vault_id self.principal_name = principal_name self.principal_id = principal_id self.tenant_id = tenant_id @@ -5832,56 +11033,62 @@ def __init__( self.app_id = app_id -class UserList(_serialization.Model): - """The response of a list operation. +class UserFragment(UpdateResource): + """Patch. - :ivar value: Results of the list operation. - :vartype value: list[~azure.mgmt.devtestlabs.models.User] - :ivar next_link: Link for next set of results. - :vartype next_link: str + :ivar tags: The tags of the resource. + :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { - "value": {"key": "value", "type": "[User]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, value: Optional[List["_models.User"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. - :paramtype value: list[~azure.mgmt.devtestlabs.models.User] - :keyword next_link: Link for next set of results. - :paramtype next_link: str + :keyword tags: The tags of the resource. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link + super().__init__(tags=tags, identity=identity, **kwargs) -class UserSecretStore(_serialization.Model): - """Properties of a user's secret store. +class UserList(_serialization.Model): + """Contains a list of users and their properties. - :ivar key_vault_uri: The URI of the user's Key vault. - :vartype key_vault_uri: str - :ivar key_vault_id: The ID of the user's Key vault. - :vartype key_vault_id: str + :ivar value: List of users and their properties. + :vartype value: list[~azure.mgmt.devtestlabs.models.User] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { - "key_vault_uri": {"key": "keyVaultUri", "type": "str"}, - "key_vault_id": {"key": "keyVaultId", "type": "str"}, + "value": {"key": "value", "type": "[User]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, key_vault_uri: Optional[str] = None, key_vault_id: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.User"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword key_vault_uri: The URI of the user's Key vault. - :paramtype key_vault_uri: str - :keyword key_vault_id: The ID of the user's Key vault. - :paramtype key_vault_id: str + :keyword value: List of users and their properties. + :paramtype value: list[~azure.mgmt.devtestlabs.models.User] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.key_vault_uri = key_vault_uri - self.key_vault_id = key_vault_id + self.value = value + self.next_link = next_link class VirtualNetwork(Resource): # pylint: disable=too-many-instance-attributes @@ -5889,16 +11096,22 @@ class VirtualNetwork(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: The tags of the resource. + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.devtestlabs.models.SystemData :ivar allowed_subnets: The allowed subnets of the virtual network. :vartype allowed_subnets: list[~azure.mgmt.devtestlabs.models.Subnet] :ivar description: The description of the virtual network. @@ -5922,6 +11135,8 @@ class VirtualNetwork(Resource): # pylint: disable=too-many-instance-attributes "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, "external_subnets": {"readonly": True}, "created_date": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -5932,8 +11147,9 @@ class VirtualNetwork(Resource): # pylint: disable=too-many-instance-attributes "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "allowed_subnets": {"key": "properties.allowedSubnets", "type": "[Subnet]"}, "description": {"key": "properties.description", "type": "str"}, "external_provider_resource_id": {"key": "properties.externalProviderResourceId", "type": "str"}, @@ -5947,19 +11163,19 @@ class VirtualNetwork(Resource): # pylint: disable=too-many-instance-attributes def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, allowed_subnets: Optional[List["_models.Subnet"]] = None, description: Optional[str] = None, external_provider_resource_id: Optional[str] = None, subnet_overrides: Optional[List["_models.SubnetOverride"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword location: The location of the resource. - :paramtype location: str - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword allowed_subnets: The allowed subnets of the virtual network. :paramtype allowed_subnets: list[~azure.mgmt.devtestlabs.models.Subnet] :keyword description: The description of the virtual network. @@ -5970,7 +11186,8 @@ def __init__( :keyword subnet_overrides: The subnet overrides of the virtual network. :paramtype subnet_overrides: list[~azure.mgmt.devtestlabs.models.SubnetOverride] """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.allowed_subnets = allowed_subnets self.description = description self.external_provider_resource_id = external_provider_resource_id @@ -5982,30 +11199,41 @@ def __init__( class VirtualNetworkFragment(UpdateResource): - """A virtual network. + """Patch. :ivar tags: The tags of the resource. :vartype tags: dict[str, str] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "IdentityProperties"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.IdentityProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the resource. :paramtype tags: dict[str, str] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.devtestlabs.models.IdentityProperties """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, identity=identity, **kwargs) class VirtualNetworkList(_serialization.Model): - """The response of a list operation. + """Contains a list of virtualNetworks and their properties. - :ivar value: Results of the list operation. + :ivar value: List of virtualNetworks and their properties. :vartype value: list[~azure.mgmt.devtestlabs.models.VirtualNetwork] - :ivar next_link: Link for next set of results. + :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -6015,12 +11243,12 @@ class VirtualNetworkList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.VirtualNetwork"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.VirtualNetwork"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Results of the list operation. + :keyword value: List of virtualNetworks and their properties. :paramtype value: list[~azure.mgmt.devtestlabs.models.VirtualNetwork] - :keyword next_link: Link for next set of results. + :keyword next_link: URL to get the next set of operation list results if there are any. :paramtype next_link: str """ super().__init__(**kwargs) @@ -6028,7 +11256,7 @@ def __init__( self.next_link = next_link -class WeekDetails(_serialization.Model): +class WeekDetailsFragment(_serialization.Model): """Properties of a weekly schedule. :ivar weekdays: The days of the week for which the schedule is set (e.g. Sunday, Monday, @@ -6043,7 +11271,7 @@ class WeekDetails(_serialization.Model): "time": {"key": "time", "type": "str"}, } - def __init__(self, *, weekdays: Optional[List[str]] = None, time: Optional[str] = None, **kwargs): + def __init__(self, *, weekdays: Optional[List[str]] = None, time: Optional[str] = None, **kwargs: Any) -> None: """ :keyword weekdays: The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). @@ -6054,25 +11282,3 @@ def __init__(self, *, weekdays: Optional[List[str]] = None, time: Optional[str] super().__init__(**kwargs) self.weekdays = weekdays self.time = time - - -class WindowsOsInfo(_serialization.Model): - """Information about a Windows OS. - - :ivar windows_os_state: The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, - SysprepApplied). Known values are: "NonSysprepped", "SysprepRequested", and "SysprepApplied". - :vartype windows_os_state: str or ~azure.mgmt.devtestlabs.models.WindowsOsState - """ - - _attribute_map = { - "windows_os_state": {"key": "windowsOsState", "type": "str"}, - } - - def __init__(self, *, windows_os_state: Optional[Union[str, "_models.WindowsOsState"]] = None, **kwargs): - """ - :keyword windows_os_state: The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, - SysprepApplied). Known values are: "NonSysprepped", "SysprepRequested", and "SysprepApplied". - :paramtype windows_os_state: str or ~azure.mgmt.devtestlabs.models.WindowsOsState - """ - super().__init__(**kwargs) - self.windows_os_state = windows_os_state diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/__init__.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/__init__.py index 7ccc7d9fe973..0d81106f3328 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/__init__.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/__init__.py @@ -13,7 +13,6 @@ from ._artifact_sources_operations import ArtifactSourcesOperations from ._arm_templates_operations import ArmTemplatesOperations from ._artifacts_operations import ArtifactsOperations -from ._costs_operations import CostsOperations from ._custom_images_operations import CustomImagesOperations from ._formulas_operations import FormulasOperations from ._gallery_images_operations import GalleryImagesOperations @@ -21,7 +20,10 @@ from ._policy_sets_operations import PolicySetsOperations from ._policies_operations import PoliciesOperations from ._schedules_operations import SchedulesOperations +from ._lab_secrets_operations import LabSecretsOperations from ._service_runners_operations import ServiceRunnersOperations +from ._shared_galleries_operations import SharedGalleriesOperations +from ._shared_images_operations import SharedImagesOperations from ._users_operations import UsersOperations from ._disks_operations import DisksOperations from ._environments_operations import EnvironmentsOperations @@ -31,9 +33,10 @@ from ._virtual_machines_operations import VirtualMachinesOperations from ._virtual_machine_schedules_operations import VirtualMachineSchedulesOperations from ._virtual_networks_operations import VirtualNetworksOperations +from ._bastion_hosts_operations import BastionHostsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -44,7 +47,6 @@ "ArtifactSourcesOperations", "ArmTemplatesOperations", "ArtifactsOperations", - "CostsOperations", "CustomImagesOperations", "FormulasOperations", "GalleryImagesOperations", @@ -52,7 +54,10 @@ "PolicySetsOperations", "PoliciesOperations", "SchedulesOperations", + "LabSecretsOperations", "ServiceRunnersOperations", + "SharedGalleriesOperations", + "SharedImagesOperations", "UsersOperations", "DisksOperations", "EnvironmentsOperations", @@ -62,6 +67,7 @@ "VirtualMachinesOperations", "VirtualMachineSchedulesOperations", "VirtualNetworksOperations", + "BastionHostsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_arm_templates_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_arm_templates_operations.py index ca065e6877dc..ed802e211ec8 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_arm_templates_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_arm_templates_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,12 +61,23 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "artifactSourceName": _SERIALIZER.url("artifact_source_name", artifact_source_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "artifactSourceName": _SERIALIZER.url( + "artifact_source_name", + artifact_source_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -103,7 +109,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,13 +119,24 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "artifactSourceName": _SERIALIZER.url("artifact_source_name", artifact_source_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "artifactSourceName": _SERIALIZER.url( + "artifact_source_name", + artifact_source_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -165,7 +182,8 @@ def list( ) -> Iterable["_models.ArmTemplate"]: """List azure resource manager templates in a given artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -174,8 +192,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=displayName)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -191,10 +209,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArmTemplateList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArmTemplateList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -222,7 +238,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -238,7 +254,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -246,14 +262,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArmTemplateList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -265,7 +282,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates" + } @distributed_trace def get( @@ -279,7 +298,8 @@ def get( ) -> _models.ArmTemplate: """Get azure resource manager template. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -306,10 +326,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArmTemplate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArmTemplate] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -324,10 +342,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,4 +362,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_artifact_sources_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_artifact_sources_operations.py index 99299fd41183..1ac8904ac49f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_artifact_sources_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_artifact_sources_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,11 +61,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -100,7 +100,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,12 +110,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -134,8 +138,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,12 +149,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +177,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,12 +187,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -201,8 +213,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -212,12 +224,16 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -262,15 +278,16 @@ def list( ) -> Iterable["_models.ArtifactSource"]: """List artifact sources in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=displayName)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -286,10 +303,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactSourceList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArtifactSourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -316,7 +331,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -332,7 +347,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -340,14 +355,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArtifactSourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -359,7 +375,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources" + } @distributed_trace def get( @@ -367,7 +385,8 @@ def get( ) -> _models.ArtifactSource: """Get artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -392,10 +411,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactSource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArtifactSource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -409,10 +426,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -428,7 +446,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}" + } @overload def create_or_update( @@ -443,7 +463,8 @@ def create_or_update( ) -> _models.ArtifactSource: """Create or replace an existing artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -473,7 +494,8 @@ def create_or_update( ) -> _models.ArtifactSource: """Create or replace an existing artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -501,14 +523,15 @@ def create_or_update( ) -> _models.ArtifactSource: """Create or replace an existing artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the artifact source. Required. :type name: str - :param artifact_source: Properties of an artifact source. Is either a model type or a IO type. - Required. + :param artifact_source: Properties of an artifact source. Is either a ArtifactSource type or a + IO type. Required. :type artifact_source: ~azure.mgmt.devtestlabs.models.ArtifactSource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -529,16 +552,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactSource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ArtifactSource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(artifact_source, (IO, bytes)): + if isinstance(artifact_source, (IOBase, bytes)): _content = artifact_source else: _json = self._serialize.body(artifact_source, "ArtifactSource") @@ -557,10 +578,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -576,11 +598,13 @@ def create_or_update( deserialized = self._deserialize("ArtifactSource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -588,7 +612,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -610,10 +635,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -626,10 +649,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -641,15 +665,24 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}" + } @distributed_trace def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.ArtifactSource: """Allows modifying tags of artifact sources. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -657,6 +690,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: ArtifactSource or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.ArtifactSource @@ -673,13 +708,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactSource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.ArtifactSource] = kwargs.pop("cls", None) - _artifact_source = _models.ArtifactSourceFragment(tags=tags) + _artifact_source = _models.ArtifactSourceFragment(identity=identity, tags=tags) _json = self._serialize.body(_artifact_source, "ArtifactSourceFragment") request = build_update_request( @@ -695,10 +728,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -714,4 +748,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_artifacts_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_artifacts_operations.py index 31e2a637a1fc..8bd3f7edf413 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_artifacts_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_artifacts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,12 +62,23 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "artifactSourceName": _SERIALIZER.url("artifact_source_name", artifact_source_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "artifactSourceName": _SERIALIZER.url( + "artifact_source_name", + artifact_source_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -103,7 +110,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,13 +120,24 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "artifactSourceName": _SERIALIZER.url("artifact_source_name", artifact_source_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "artifactSourceName": _SERIALIZER.url( + "artifact_source_name", + artifact_source_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -138,8 +156,8 @@ def build_generate_arm_template_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,13 +167,24 @@ def build_generate_arm_template_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "artifactSourceName": _SERIALIZER.url("artifact_source_name", artifact_source_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "artifactSourceName": _SERIALIZER.url( + "artifact_source_name", + artifact_source_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -201,7 +230,8 @@ def list( ) -> Iterable["_models.Artifact"]: """List artifacts in a given artifact source. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -210,8 +240,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=title)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -227,10 +257,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArtifactList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ArtifactList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -258,7 +286,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -274,7 +302,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -282,14 +310,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ArtifactList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -301,7 +330,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts" + } @distributed_trace def get( @@ -315,7 +346,8 @@ def get( ) -> _models.Artifact: """Get artifact. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -342,10 +374,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Artifact] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Artifact] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -360,10 +390,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,7 +410,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}" + } @overload def generate_arm_template( @@ -396,7 +429,8 @@ def generate_arm_template( """Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -431,7 +465,8 @@ def generate_arm_template( """Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -464,7 +499,8 @@ def generate_arm_template( """Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -473,7 +509,7 @@ def generate_arm_template( :param name: The name of the artifact. Required. :type name: str :param generate_arm_template_request: Parameters for generating an ARM template for deploying - artifacts. Is either a model type or a IO type. Required. + artifacts. Is either a GenerateArmTemplateRequest type or a IO type. Required. :type generate_arm_template_request: ~azure.mgmt.devtestlabs.models.GenerateArmTemplateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -495,16 +531,14 @@ def generate_arm_template( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ArmTemplateInfo] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ArmTemplateInfo] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(generate_arm_template_request, (IO, bytes)): + if isinstance(generate_arm_template_request, (IOBase, bytes)): _content = generate_arm_template_request else: _json = self._serialize.body(generate_arm_template_request, "GenerateArmTemplateRequest") @@ -524,10 +558,11 @@ def generate_arm_template( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,4 +578,6 @@ def generate_arm_template( return deserialized - generate_arm_template.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate"} # type: ignore + generate_arm_template.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_bastion_hosts_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_bastion_hosts_operations.py new file mode 100644 index 000000000000..d6700d4b80d9 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_bastion_hosts_operations.py @@ -0,0 +1,859 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=260, + min_length=1, + pattern=r"^[a-zA-Z0-9_\-]+$", + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class BastionHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devtestlabs.DevTestLabsClient`'s + :attr:`bastion_hosts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.BastionHost"]: + """List bastionhosts in a given virtual network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BastionHost or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devtestlabs.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BastionHostList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BastionHostList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts" + } + + @distributed_trace + def get( + self, resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, **kwargs: Any + ) -> _models.BastionHost: + """Get bastionhost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param name: The name of the bastionhost. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BastionHost or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.BastionHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> _models.BastionHost: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + + _bastion_host = _models.BastionHost(location=location, tags=tags) + _json = self._serialize.body(_bastion_host, "BastionHost") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("BastionHost", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> LROPoller[_models.BastionHost]: + """Create or replace an existing bastionHost. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param name: The name of the bastionhost. Required. + :type name: str + :param location: The geo-location where the resource lives. Required. + :type location: str + :param tags: Resource tags. Default value is None. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BastionHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devtestlabs.models.BastionHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + location=location, + tags=tags, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BastionHost", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, lab_name: str, virtual_network_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete bastionhost. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param name: The name of the bastionhost. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } + + @distributed_trace + def update( + self, + resource_group_name: str, + lab_name: str, + virtual_network_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> _models.BastionHost: + """Allows modifying tags of bastionhosts. All other properties will be ignored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param virtual_network_name: The name of the virtual network. Required. + :type virtual_network_name: str + :param name: The name of the bastionhost. Required. + :type name: str + :param tags: The tags of the resource. Default value is None. + :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BastionHost or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.BastionHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.BastionHost] = kwargs.pop("cls", None) + + _bastion_host = _models.BastionHostFragment(identity=identity, tags=tags) + _json = self._serialize.body(_bastion_host, "BastionHostFragment") + + request = build_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_network_name=virtual_network_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BastionHost", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{virtualNetworkName}/bastionhosts/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_costs_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_costs_operations.py deleted file mode 100644 index 3eeb08ac9cd7..000000000000 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_costs_operations.py +++ /dev/null @@ -1,349 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - lab_name: str, - name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class CostsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.devtestlabs.DevTestLabsClient`'s - :attr:`costs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, lab_name: str, name: str, expand: Optional[str] = None, **kwargs: Any - ) -> _models.LabCost: - """Get cost. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the cost. Required. - :type name: str - :param expand: Specify the $expand query. Example: 'properties($expand=labCostDetails)'. - Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabCost or the result of cls(response) - :rtype: ~azure.mgmt.devtestlabs.models.LabCost - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabCost] - - request = build_get_request( - resource_group_name=resource_group_name, - lab_name=lab_name, - name=name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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("LabCost", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}"} # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - lab_name: str, - name: str, - lab_cost: _models.LabCost, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LabCost: - """Create or replace an existing cost. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the cost. Required. - :type name: str - :param lab_cost: A cost item. Required. - :type lab_cost: ~azure.mgmt.devtestlabs.models.LabCost - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabCost or the result of cls(response) - :rtype: ~azure.mgmt.devtestlabs.models.LabCost - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - lab_name: str, - name: str, - lab_cost: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LabCost: - """Create or replace an existing cost. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the cost. Required. - :type name: str - :param lab_cost: A cost item. Required. - :type lab_cost: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabCost or the result of cls(response) - :rtype: ~azure.mgmt.devtestlabs.models.LabCost - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, resource_group_name: str, lab_name: str, name: str, lab_cost: Union[_models.LabCost, IO], **kwargs: Any - ) -> _models.LabCost: - """Create or replace an existing cost. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the cost. Required. - :type name: str - :param lab_cost: A cost item. Is either a model type or a IO type. Required. - :type lab_cost: ~azure.mgmt.devtestlabs.models.LabCost or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabCost or the result of cls(response) - :rtype: ~azure.mgmt.devtestlabs.models.LabCost - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabCost] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(lab_cost, (IO, bytes)): - _content = lab_cost - else: - _json = self._serialize.body(lab_cost, "LabCost") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - lab_name=lab_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("LabCost", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LabCost", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}"} # type: ignore diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_custom_images_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_custom_images_operations.py index 7cbfdf0c3f4f..57e2fe550f18 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_custom_images_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_custom_images_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,11 +63,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -102,7 +102,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,12 +112,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -136,8 +140,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,12 +151,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +179,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,12 +189,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,8 +215,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,12 +226,16 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,15 +280,16 @@ def list( ) -> Iterable["_models.CustomImage"]: """List custom images in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=vm)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -288,10 +305,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImageList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomImageList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -318,7 +333,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -334,7 +349,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -342,14 +357,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomImageList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,7 +377,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages" + } @distributed_trace def get( @@ -369,7 +387,8 @@ def get( ) -> _models.CustomImage: """Get custom image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -394,10 +413,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomImage] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -411,10 +428,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,7 +448,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } def _create_or_update_initial( self, @@ -451,16 +471,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomImage] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_image, (IO, bytes)): + if isinstance(custom_image, (IOBase, bytes)): _content = custom_image else: _json = self._serialize.body(custom_image, "CustomImage") @@ -479,10 +497,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,11 +517,13 @@ def _create_or_update_initial( deserialized = self._deserialize("CustomImage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } @overload def begin_create_or_update( @@ -517,7 +538,8 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomImage]: """Create or replace an existing custom image. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -555,7 +577,8 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomImage]: """Create or replace an existing custom image. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -591,13 +614,14 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomImage]: """Create or replace an existing custom image. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the custom image. Required. :type name: str - :param custom_image: A custom image. Is either a model type or a IO type. Required. + :param custom_image: A custom image. Is either a CustomImage type or a IO type. Required. :type custom_image: ~azure.mgmt.devtestlabs.models.CustomImage or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -618,16 +642,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImage] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomImage] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -648,7 +670,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -660,9 +684,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -678,10 +704,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -694,10 +718,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -706,16 +731,26 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } @distributed_trace def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Delete custom image. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -736,13 +771,11 @@ def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -761,7 +794,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -773,17 +808,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } @distributed_trace def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.CustomImage: """Allows modifying tags of custom images. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -791,6 +835,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomImage or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.CustomImage @@ -807,13 +853,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomImage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.CustomImage] = kwargs.pop("cls", None) - _custom_image = _models.CustomImageFragment(tags=tags) + _custom_image = _models.CustomImageFragment(identity=identity, tags=tags) _json = self._serialize.body(_custom_image, "CustomImageFragment") request = build_update_request( @@ -829,10 +873,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -848,4 +893,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_disks_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_disks_operations.py index dab2da17ceae..e70bd77ee371 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_disks_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_disks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,12 +64,16 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -105,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,13 +115,17 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -140,8 +144,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,13 +155,17 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,13 +194,17 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,8 +221,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,13 +232,17 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,8 +261,8 @@ def build_attach_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -256,13 +272,17 @@ def build_attach_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,8 +301,8 @@ def build_detach_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -292,13 +312,17 @@ def build_detach_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -344,7 +368,8 @@ def list( ) -> Iterable["_models.Disk"]: """List disks in a given user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -353,8 +378,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=diskType)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -370,10 +395,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DiskList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -401,7 +424,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -417,7 +440,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -425,14 +448,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,7 +468,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks" + } @distributed_trace def get( @@ -458,7 +484,8 @@ def get( ) -> _models.Disk: """Get disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -485,10 +512,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Disk] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -503,10 +528,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,7 +548,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } def _create_or_update_initial( self, @@ -544,16 +572,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Disk] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk, (IO, bytes)): + if isinstance(disk, (IOBase, bytes)): _content = disk else: _json = self._serialize.body(disk, "Disk") @@ -573,10 +599,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,11 +619,13 @@ def _create_or_update_initial( deserialized = self._deserialize("Disk", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } @overload def begin_create_or_update( @@ -612,7 +641,8 @@ def begin_create_or_update( ) -> LROPoller[_models.Disk]: """Create or replace an existing disk. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -652,7 +682,8 @@ def begin_create_or_update( ) -> LROPoller[_models.Disk]: """Create or replace an existing disk. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -690,7 +721,8 @@ def begin_create_or_update( ) -> LROPoller[_models.Disk]: """Create or replace an existing disk. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -698,7 +730,7 @@ def begin_create_or_update( :type user_name: str :param name: The name of the disk. Required. :type name: str - :param disk: A Disk. Is either a model type or a IO type. Required. + :param disk: A Disk. Is either a Disk type or a IO type. Required. :type disk: ~azure.mgmt.devtestlabs.models.Disk or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -718,16 +750,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Disk] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, user_name=user_name, @@ -749,7 +779,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -761,9 +791,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -779,10 +811,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -796,10 +826,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -808,10 +839,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } @distributed_trace def begin_delete( @@ -819,7 +859,8 @@ def begin_delete( ) -> LROPoller[None]: """Delete disk. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -842,13 +883,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -868,7 +907,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -880,9 +921,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } @distributed_trace def update( @@ -892,11 +935,13 @@ def update( user_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Disk: """Allows modifying tags of disks. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -906,6 +951,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Disk or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Disk @@ -922,13 +969,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Disk] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - _disk = _models.DiskFragment(tags=tags) + _disk = _models.DiskFragment(identity=identity, tags=tags) _json = self._serialize.body(_disk, "DiskFragment") request = build_update_request( @@ -945,10 +990,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -964,7 +1010,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}" + } def _attach_initial( # pylint: disable=inconsistent-return-statements self, @@ -986,11 +1034,9 @@ def _attach_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _attach_disk_properties = _models.AttachDiskProperties(leased_by_lab_vm_id=leased_by_lab_vm_id) _json = self._serialize.body(_attach_disk_properties, "AttachDiskProperties") @@ -1009,10 +1055,11 @@ def _attach_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1021,10 +1068,19 @@ def _attach_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _attach_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach"} # type: ignore + _attach_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach" + } @distributed_trace def begin_attach( @@ -1039,7 +1095,8 @@ def begin_attach( """Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1065,14 +1122,12 @@ def begin_attach( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._attach_initial( # type: ignore resource_group_name=resource_group_name, @@ -1094,7 +1149,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1106,9 +1163,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_attach.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach"} # type: ignore + begin_attach.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach" + } def _detach_initial( # pylint: disable=inconsistent-return-statements self, @@ -1130,11 +1189,9 @@ def _detach_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _detach_disk_properties = _models.DetachDiskProperties(leased_by_lab_vm_id=leased_by_lab_vm_id) _json = self._serialize.body(_detach_disk_properties, "DetachDiskProperties") @@ -1153,10 +1210,11 @@ def _detach_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1165,10 +1223,19 @@ def _detach_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _detach_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach"} # type: ignore + _detach_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach" + } @distributed_trace def begin_detach( @@ -1183,7 +1250,8 @@ def begin_detach( """Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1209,14 +1277,12 @@ def begin_detach( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._detach_initial( # type: ignore resource_group_name=resource_group_name, @@ -1238,7 +1304,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1250,6 +1318,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_detach.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach"} # type: ignore + begin_detach.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_environments_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_environments_operations.py index b46ed2a22ff7..9d4a5d6cea8a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_environments_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_environments_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,12 +64,16 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -105,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,13 +115,17 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -140,8 +144,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,13 +155,17 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,13 +194,17 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,8 +221,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,13 +232,17 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -272,7 +288,8 @@ def list( ) -> Iterable["_models.DtlEnvironment"]: """List environments in a given user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -281,8 +298,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=deploymentProperties)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -298,10 +315,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironmentList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DtlEnvironmentList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -329,7 +344,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -345,7 +360,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,14 +368,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DtlEnvironmentList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,7 +388,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments" + } @distributed_trace def get( @@ -386,7 +404,8 @@ def get( ) -> _models.DtlEnvironment: """Get environment. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -413,10 +432,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DtlEnvironment] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -431,10 +448,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,7 +468,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } def _create_or_update_initial( self, @@ -472,16 +492,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DtlEnvironment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(dtl_environment, (IO, bytes)): + if isinstance(dtl_environment, (IOBase, bytes)): _content = dtl_environment else: _json = self._serialize.body(dtl_environment, "DtlEnvironment") @@ -501,10 +519,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,11 +539,13 @@ def _create_or_update_initial( deserialized = self._deserialize("DtlEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } @overload def begin_create_or_update( @@ -540,7 +561,8 @@ def begin_create_or_update( ) -> LROPoller[_models.DtlEnvironment]: """Create or replace an existing environment. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -582,7 +604,8 @@ def begin_create_or_update( ) -> LROPoller[_models.DtlEnvironment]: """Create or replace an existing environment. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -622,7 +645,8 @@ def begin_create_or_update( ) -> LROPoller[_models.DtlEnvironment]: """Create or replace an existing environment. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -631,7 +655,7 @@ def begin_create_or_update( :param name: The name of the environment. Required. :type name: str :param dtl_environment: An environment, which is essentially an ARM template deployment. Is - either a model type or a IO type. Required. + either a DtlEnvironment type or a IO type. Required. :type dtl_environment: ~azure.mgmt.devtestlabs.models.DtlEnvironment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -652,16 +676,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironment] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DtlEnvironment] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, user_name=user_name, @@ -683,7 +705,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -695,9 +719,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -713,10 +739,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -730,10 +754,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,10 +767,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } @distributed_trace def begin_delete( @@ -753,7 +787,8 @@ def begin_delete( ) -> LROPoller[None]: """Delete environment. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -776,13 +811,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -802,7 +835,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -814,9 +849,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } @distributed_trace def update( @@ -826,11 +863,13 @@ def update( user_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.DtlEnvironment: """Allows modifying tags of environments. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -840,6 +879,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: DtlEnvironment or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.DtlEnvironment @@ -856,13 +897,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.DtlEnvironment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.DtlEnvironment] = kwargs.pop("cls", None) - _dtl_environment = _models.DtlEnvironmentFragment(tags=tags) + _dtl_environment = _models.DtlEnvironmentFragment(identity=identity, tags=tags) _json = self._serialize.body(_dtl_environment, "DtlEnvironmentFragment") request = build_update_request( @@ -879,10 +918,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -898,4 +938,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_formulas_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_formulas_operations.py index 8aa6773e6c97..0e52a3c651df 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_formulas_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_formulas_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,11 +63,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -102,7 +102,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,12 +112,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -136,8 +140,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,12 +151,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +179,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,12 +189,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,8 +215,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,12 +226,16 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,15 +280,16 @@ def list( ) -> Iterable["_models.Formula"]: """List formulas in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=description)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -288,10 +305,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FormulaList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FormulaList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -318,7 +333,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -334,7 +349,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -342,14 +357,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("FormulaList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,7 +377,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas" + } @distributed_trace def get( @@ -369,7 +387,8 @@ def get( ) -> _models.Formula: """Get formula. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -394,10 +413,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Formula] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Formula] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -411,10 +428,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,7 +448,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } def _create_or_update_initial( self, resource_group_name: str, lab_name: str, name: str, formula: Union[_models.Formula, IO], **kwargs: Any @@ -446,16 +466,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Formula] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Formula] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(formula, (IO, bytes)): + if isinstance(formula, (IOBase, bytes)): _content = formula else: _json = self._serialize.body(formula, "Formula") @@ -474,10 +492,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,11 +512,13 @@ def _create_or_update_initial( deserialized = self._deserialize("Formula", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } @overload def begin_create_or_update( @@ -510,9 +531,10 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Formula]: - """Create or replace an existing formula. This operation can take a while to complete. + """Create or replace an existing Formula. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -548,9 +570,10 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Formula]: - """Create or replace an existing formula. This operation can take a while to complete. + """Create or replace an existing Formula. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -579,16 +602,17 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, lab_name: str, name: str, formula: Union[_models.Formula, IO], **kwargs: Any ) -> LROPoller[_models.Formula]: - """Create or replace an existing formula. This operation can take a while to complete. + """Create or replace an existing Formula. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the formula. Required. :type name: str :param formula: A formula for creating a VM, specifying an image base and other parameters. Is - either a model type or a IO type. Required. + either a Formula type or a IO type. Required. :type formula: ~azure.mgmt.devtestlabs.models.Formula or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -608,16 +632,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Formula] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Formula] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -638,7 +660,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -650,9 +674,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -660,7 +686,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete formula. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -682,10 +709,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -698,10 +723,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -713,15 +739,24 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } @distributed_trace def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.Formula: """Allows modifying tags of formulas. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -729,6 +764,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Formula or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Formula @@ -745,13 +782,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Formula] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Formula] = kwargs.pop("cls", None) - _formula = _models.FormulaFragment(tags=tags) + _formula = _models.FormulaFragment(identity=identity, tags=tags) _json = self._serialize.body(_formula, "FormulaFragment") request = build_update_request( @@ -767,10 +802,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -786,4 +822,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_gallery_images_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_gallery_images_operations.py index 1e8a55fdd5dc..469a339af42a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_gallery_images_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_gallery_images_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,11 +60,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -88,6 +87,42 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + class GalleryImagesOperations: """ .. warning:: @@ -120,15 +155,16 @@ def list( ) -> Iterable["_models.GalleryImage"]: """List gallery images in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=author)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -144,10 +180,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GalleryImageList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GalleryImageList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -174,7 +208,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -190,7 +224,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -198,14 +232,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("GalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,4 +252,71 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages" + } + + @distributed_trace + def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> _models.GalleryImage: + """Get gallery image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the gallery image. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.GalleryImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GalleryImage] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GalleryImage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_global_schedules_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_global_schedules_operations.py index 4fc979478875..64dcf90dbaea 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_global_schedules_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_global_schedules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +51,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -96,7 +92,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,10 +102,12 @@ def build_list_by_resource_group_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -134,7 +132,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,11 +142,13 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -167,8 +167,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,11 +178,13 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +201,7 @@ def build_delete_request(resource_group_name: str, name: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,11 +211,13 @@ def build_delete_request(resource_group_name: str, name: str, subscription_id: s ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,8 +232,8 @@ def build_update_request(resource_group_name: str, name: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,11 +243,13 @@ def build_update_request(resource_group_name: str, name: str, subscription_id: s ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -260,7 +266,7 @@ def build_execute_request(resource_group_name: str, name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,11 +276,13 @@ def build_execute_request(resource_group_name: str, name: str, subscription_id: ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -289,8 +297,8 @@ def build_retarget_request(resource_group_name: str, name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -300,11 +308,13 @@ def build_retarget_request(resource_group_name: str, name: str, subscription_id: ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -350,8 +360,8 @@ def list_by_subscription( :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -367,10 +377,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -395,7 +403,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -411,7 +419,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -419,14 +427,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -438,7 +447,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules"} @distributed_trace def list_by_resource_group( @@ -452,13 +461,14 @@ def list_by_resource_group( ) -> Iterable["_models.Schedule"]: """List schedules in a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -474,10 +484,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -503,7 +511,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -519,7 +527,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -527,14 +535,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,13 +555,16 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules" + } @distributed_trace def get(self, resource_group_name: str, name: str, expand: Optional[str] = None, **kwargs: Any) -> _models.Schedule: """Get schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -575,10 +587,8 @@ def get(self, resource_group_name: str, name: str, expand: Optional[str] = None, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -591,10 +601,11 @@ def get(self, resource_group_name: str, name: str, expand: Optional[str] = None, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -610,7 +621,9 @@ def get(self, resource_group_name: str, name: str, expand: Optional[str] = None, return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" + } @overload def create_or_update( @@ -624,7 +637,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -651,7 +665,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -672,11 +687,12 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str - :param schedule: A schedule. Is either a model type or a IO type. Required. + :param schedule: A schedule. Is either a Schedule type or a IO type. Required. :type schedule: ~azure.mgmt.devtestlabs.models.Schedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -697,16 +713,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(schedule, (IO, bytes)): + if isinstance(schedule, (IOBase, bytes)): _content = schedule else: _json = self._serialize.body(schedule, "Schedule") @@ -724,10 +738,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -743,11 +758,13 @@ def create_or_update( deserialized = self._deserialize("Schedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -755,7 +772,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -775,10 +793,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -790,10 +806,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -805,20 +822,30 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" + } @distributed_trace def update( - self, resource_group_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.Schedule: """Allows modifying tags of schedules. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Schedule @@ -835,13 +862,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _schedule = _models.ScheduleFragment(tags=tags) + _schedule = _models.ScheduleFragment(identity=identity, tags=tags) _json = self._serialize.body(_schedule, "ScheduleFragment") request = build_update_request( @@ -856,10 +881,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -875,7 +901,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" + } def _execute_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -891,10 +919,8 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( resource_group_name=resource_group_name, @@ -906,10 +932,11 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -918,16 +945,26 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _execute_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute"} # type: ignore + _execute_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute" + } @distributed_trace def begin_execute(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Execute a schedule. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -946,13 +983,11 @@ def begin_execute(self, resource_group_name: str, name: str, **kwargs: Any) -> L _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._execute_initial( # type: ignore resource_group_name=resource_group_name, @@ -970,7 +1005,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -982,9 +1019,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_execute.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute"} # type: ignore + begin_execute.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute" + } def _retarget_initial( # pylint: disable=inconsistent-return-statements self, @@ -1005,11 +1044,9 @@ def _retarget_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _retarget_schedule_properties = _models.RetargetScheduleProperties( current_resource_id=current_resource_id, target_resource_id=target_resource_id @@ -1028,10 +1065,11 @@ def _retarget_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1040,10 +1078,19 @@ def _retarget_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _retarget_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget"} # type: ignore + _retarget_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget" + } @distributed_trace def begin_retarget( @@ -1056,7 +1103,8 @@ def begin_retarget( ) -> LROPoller[None]: """Updates a schedule's target resource Id. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the schedule. Required. :type name: str @@ -1081,14 +1129,12 @@ def begin_retarget( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._retarget_initial( # type: ignore resource_group_name=resource_group_name, @@ -1109,7 +1155,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1121,6 +1169,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_retarget.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget"} # type: ignore + begin_retarget.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_lab_secrets_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_lab_secrets_operations.py new file mode 100644 index 000000000000..0bc1de935fed --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_lab_secrets_operations.py @@ -0,0 +1,948 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + lab_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class LabSecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devtestlabs.DevTestLabsClient`'s + :attr:`lab_secrets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.LabSecret"]: + """List lab secrets in a given lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LabSecret or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabSecretList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LabSecretList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets" + } + + @distributed_trace + def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> _models.LabSecret: + """Get lab secret. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LabSecret or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.LabSecret + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LabSecret", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + lab_name: str, + name: str, + lab_secret: Union[_models.LabSecret, IO], + **kwargs: Any + ) -> _models.LabSecret: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(lab_secret, (IOBase, bytes)): + _content = lab_secret + else: + _json = self._serialize.body(lab_secret, "LabSecret") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("LabSecret", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("LabSecret", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + lab_secret: _models.LabSecret, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LabSecret]: + """Create or replace an existing Lab Secret. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :param lab_secret: A shared secret in a lab. Required. + :type lab_secret: ~azure.mgmt.devtestlabs.models.LabSecret + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabSecret or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + lab_secret: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LabSecret]: + """Create or replace an existing Lab Secret. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :param lab_secret: A shared secret in a lab. Required. + :type lab_secret: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabSecret or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + lab_secret: Union[_models.LabSecret, IO], + **kwargs: Any + ) -> LROPoller[_models.LabSecret]: + """Create or replace an existing Lab Secret. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :param lab_secret: A shared secret in a lab. Is either a LabSecret type or a IO type. Required. + :type lab_secret: ~azure.mgmt.devtestlabs.models.LabSecret or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabSecret or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + lab_secret=lab_secret, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabSecret", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Delete lab secret. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + def _update_initial( + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> _models.LabSecret: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + + _secret = _models.SecretFragment(identity=identity, tags=tags) + _json = self._serialize.body(_secret, "SecretFragment") + + request = build_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LabSecret", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("LabSecret", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> LROPoller[_models.LabSecret]: + """Allows modifying tags of lab secrets. All other properties will be ignored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the lab secret. Required. + :type name: str + :param tags: The tags of the resource. Default value is None. + :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabSecret or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.devtestlabs.models.LabSecret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.LabSecret] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + tags=tags, + identity=identity, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabSecret", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/secrets/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_labs_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_labs_operations.py index 8d4bfa4f3422..57e317254ddc 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_labs_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_labs_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,12 +31,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +52,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +61,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -97,7 +93,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,10 +103,12 @@ def build_list_by_resource_group_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -135,7 +133,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,11 +143,13 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -168,8 +168,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,11 +179,13 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -200,7 +202,7 @@ def build_delete_request(resource_group_name: str, name: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,11 +212,13 @@ def build_delete_request(resource_group_name: str, name: str, subscription_id: s ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,8 +233,8 @@ def build_update_request(resource_group_name: str, name: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,11 +244,13 @@ def build_update_request(resource_group_name: str, name: str, subscription_id: s ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -261,7 +267,7 @@ def build_claim_any_vm_request(resource_group_name: str, name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -271,11 +277,13 @@ def build_claim_any_vm_request(resource_group_name: str, name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -292,8 +300,8 @@ def build_create_environment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,11 +311,13 @@ def build_create_environment_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,14 +330,47 @@ def build_create_environment_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_ensure_current_user_profile_request( + resource_group_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/ensureCurrentUserProfile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_export_resource_usage_request( resource_group_name: str, name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -337,11 +380,13 @@ def build_export_resource_usage_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -360,8 +405,8 @@ def build_generate_upload_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -371,11 +416,13 @@ def build_generate_upload_uri_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -394,8 +441,8 @@ def build_import_virtual_machine_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -405,11 +452,13 @@ def build_import_virtual_machine_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -426,7 +475,7 @@ def build_list_vhds_request(resource_group_name: str, name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -436,11 +485,13 @@ def build_list_vhds_request(resource_group_name: str, name: str, subscription_id ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -484,8 +535,8 @@ def list_by_subscription( :param expand: Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -501,10 +552,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -529,7 +578,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -545,7 +594,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -553,14 +602,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("LabList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -572,7 +622,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs"} @distributed_trace def list_by_resource_group( @@ -586,13 +636,14 @@ def list_by_resource_group( ) -> Iterable["_models.Lab"]: """List labs in a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param expand: Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -608,10 +659,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -637,7 +686,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -653,7 +702,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -661,14 +710,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("LabList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -680,13 +730,16 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + } @distributed_trace def get(self, resource_group_name: str, name: str, expand: Optional[str] = None, **kwargs: Any) -> _models.Lab: """Get lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -709,10 +762,8 @@ def get(self, resource_group_name: str, name: str, expand: Optional[str] = None, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Lab] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Lab] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -725,10 +776,11 @@ def get(self, resource_group_name: str, name: str, expand: Optional[str] = None, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -744,7 +796,9 @@ def get(self, resource_group_name: str, name: str, expand: Optional[str] = None, return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } def _create_or_update_initial( self, resource_group_name: str, name: str, lab: Union[_models.Lab, IO], **kwargs: Any @@ -760,16 +814,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Lab] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Lab] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(lab, (IO, bytes)): + if isinstance(lab, (IOBase, bytes)): _content = lab else: _json = self._serialize.body(lab, "Lab") @@ -787,10 +839,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -806,11 +859,13 @@ def _create_or_update_initial( deserialized = self._deserialize("Lab", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } @overload def begin_create_or_update( @@ -824,7 +879,8 @@ def begin_create_or_update( ) -> LROPoller[_models.Lab]: """Create or replace an existing lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -852,7 +908,8 @@ def begin_create_or_update( ) -> LROPoller[_models.Lab]: """Create or replace an existing lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -880,11 +937,12 @@ def begin_create_or_update( ) -> LROPoller[_models.Lab]: """Create or replace an existing lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str - :param lab: A lab. Is either a model type or a IO type. Required. + :param lab: A lab. Is either a Lab type or a IO type. Required. :type lab: ~azure.mgmt.devtestlabs.models.Lab or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -904,16 +962,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Lab] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Lab] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, name=name, lab=lab, @@ -933,7 +989,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -945,9 +1003,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -963,10 +1023,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -978,10 +1036,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -990,16 +1049,26 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Delete lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1018,13 +1087,11 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1042,7 +1109,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1054,22 +1123,32 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } @distributed_trace def update( - self, resource_group_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.Lab: """Allows modifying tags of labs. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Lab or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Lab @@ -1086,13 +1165,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Lab] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Lab] = kwargs.pop("cls", None) - _lab = _models.LabFragment(tags=tags) + _lab = _models.LabFragment(identity=identity, tags=tags) _json = self._serialize.body(_lab, "LabFragment") request = build_update_request( @@ -1107,10 +1184,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1126,7 +1204,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}" + } def _claim_any_vm_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -1142,10 +1222,8 @@ def _claim_any_vm_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_claim_any_vm_request( resource_group_name=resource_group_name, @@ -1157,10 +1235,11 @@ def _claim_any_vm_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1169,17 +1248,27 @@ def _claim_any_vm_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _claim_any_vm_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm"} # type: ignore + _claim_any_vm_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm" + } @distributed_trace def begin_claim_any_vm(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Claim a random claimable virtual machine in the lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1198,13 +1287,11 @@ def begin_claim_any_vm(self, resource_group_name: str, name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._claim_any_vm_initial( # type: ignore resource_group_name=resource_group_name, @@ -1222,7 +1309,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1234,9 +1323,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_claim_any_vm.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm"} # type: ignore + begin_claim_any_vm.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm" + } def _create_environment_initial( # pylint: disable=inconsistent-return-statements self, @@ -1256,16 +1347,14 @@ def _create_environment_initial( # pylint: disable=inconsistent-return-statemen _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(lab_virtual_machine_creation_parameter, (IO, bytes)): + if isinstance(lab_virtual_machine_creation_parameter, (IOBase, bytes)): _content = lab_virtual_machine_creation_parameter else: _json = self._serialize.body(lab_virtual_machine_creation_parameter, "LabVirtualMachineCreationParameter") @@ -1283,10 +1372,11 @@ def _create_environment_initial( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1295,10 +1385,19 @@ def _create_environment_initial( # pylint: disable=inconsistent-return-statemen map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _create_environment_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment"} # type: ignore + _create_environment_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment" + } @overload def begin_create_environment( @@ -1312,7 +1411,8 @@ def begin_create_environment( ) -> LROPoller[None]: """Create virtual machines in a lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1348,7 +1448,8 @@ def begin_create_environment( ) -> LROPoller[None]: """Create virtual machines in a lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1381,12 +1482,13 @@ def begin_create_environment( ) -> LROPoller[None]: """Create virtual machines in a lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str :param lab_virtual_machine_creation_parameter: Properties for creating a virtual machine. Is - either a model type or a IO type. Required. + either a LabVirtualMachineCreationParameter type or a IO type. Required. :type lab_virtual_machine_creation_parameter: ~azure.mgmt.devtestlabs.models.LabVirtualMachineCreationParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1407,14 +1509,12 @@ def begin_create_environment( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_environment_initial( # type: ignore resource_group_name=resource_group_name, @@ -1434,7 +1534,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1446,9 +1548,71 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_environment.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment" + } + + @distributed_trace + def ensure_current_user_profile( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, name: str, **kwargs: Any + ) -> None: + """Ensure the current user has a valid profile in the lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the lab. Required. + :type 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_ensure_current_user_profile_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.ensure_current_user_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - begin_create_environment.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment"} # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + ensure_current_user_profile.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/ensureCurrentUserProfile" + } def _export_resource_usage_initial( # pylint: disable=inconsistent-return-statements self, @@ -1469,11 +1633,9 @@ def _export_resource_usage_initial( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _export_resource_usage_parameters = _models.ExportResourceUsageParameters( blob_storage_absolute_sas_uri=blob_storage_absolute_sas_uri, usage_start_date=usage_start_date @@ -1492,10 +1654,11 @@ def _export_resource_usage_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1504,10 +1667,19 @@ def _export_resource_usage_initial( # pylint: disable=inconsistent-return-state map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _export_resource_usage_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage"} # type: ignore + _export_resource_usage_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage" + } @distributed_trace def begin_export_resource_usage( @@ -1521,7 +1693,8 @@ def begin_export_resource_usage( """Exports the lab resource usage into a storage account This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1546,14 +1719,12 @@ def begin_export_resource_usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._export_resource_usage_initial( # type: ignore resource_group_name=resource_group_name, @@ -1574,7 +1745,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1586,9 +1759,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_export_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage"} # type: ignore + begin_export_resource_usage.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage" + } @distributed_trace def generate_upload_uri( @@ -1596,7 +1771,8 @@ def generate_upload_uri( ) -> _models.GenerateUploadUriResponse: """Generate a URI for uploading custom disk images to a Lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1618,11 +1794,9 @@ def generate_upload_uri( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateUploadUriResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.GenerateUploadUriResponse] = kwargs.pop("cls", None) _generate_upload_uri_parameter = _models.GenerateUploadUriParameter(blob_name=blob_name) _json = self._serialize.body(_generate_upload_uri_parameter, "GenerateUploadUriParameter") @@ -1639,10 +1813,11 @@ def generate_upload_uri( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1658,7 +1833,9 @@ def generate_upload_uri( return deserialized - generate_upload_uri.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri"} # type: ignore + generate_upload_uri.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri" + } def _import_virtual_machine_initial( # pylint: disable=inconsistent-return-statements self, @@ -1679,11 +1856,9 @@ def _import_virtual_machine_initial( # pylint: disable=inconsistent-return-stat _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _import_lab_virtual_machine_request = _models.ImportLabVirtualMachineRequest( destination_virtual_machine_name=destination_virtual_machine_name, @@ -1703,10 +1878,11 @@ def _import_virtual_machine_initial( # pylint: disable=inconsistent-return-stat params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1715,10 +1891,19 @@ def _import_virtual_machine_initial( # pylint: disable=inconsistent-return-stat map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _import_virtual_machine_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine"} # type: ignore + _import_virtual_machine_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine" + } @distributed_trace def begin_import_virtual_machine( @@ -1731,7 +1916,8 @@ def begin_import_virtual_machine( ) -> LROPoller[None]: """Import a virtual machine into a different lab. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1756,14 +1942,12 @@ def begin_import_virtual_machine( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._import_virtual_machine_initial( # type: ignore resource_group_name=resource_group_name, @@ -1784,7 +1968,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1796,15 +1982,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_import_virtual_machine.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine"} # type: ignore + begin_import_virtual_machine.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine" + } @distributed_trace def list_vhds(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterable["_models.LabVhd"]: """List disk images available for custom image creation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param name: The name of the lab. Required. :type name: str @@ -1816,10 +2005,8 @@ def list_vhds(self, resource_group_name: str, name: str, **kwargs: Any) -> Itera _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVhdList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabVhdList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1842,7 +2029,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1858,7 +2045,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1866,14 +2053,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("LabVhdList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1885,4 +2073,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_vhds.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds"} # type: ignore + list_vhds.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_notification_channels_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_notification_channels_operations.py index 9d291dd11db1..90519683c860 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_notification_channels_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_notification_channels_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,11 +61,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -100,7 +100,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,12 +110,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -134,8 +138,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,12 +149,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +177,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,12 +187,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -201,8 +213,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -212,12 +224,16 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -236,8 +252,8 @@ def build_notify_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -247,12 +263,16 @@ def build_notify_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -297,15 +317,16 @@ def list( ) -> Iterable["_models.NotificationChannel"]: """List notification channels in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=webHookUrl)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -321,10 +342,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationChannelList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotificationChannelList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -351,7 +370,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -367,7 +386,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -375,14 +394,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NotificationChannelList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,7 +414,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels" + } @distributed_trace def get( @@ -402,7 +424,8 @@ def get( ) -> _models.NotificationChannel: """Get notification channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -427,10 +450,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationChannel] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotificationChannel] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -444,10 +465,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -463,7 +485,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}" + } @overload def create_or_update( @@ -476,9 +500,10 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.NotificationChannel: - """Create or replace an existing notification channel. + """Create or replace an existing Notification Channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -506,9 +531,10 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.NotificationChannel: - """Create or replace an existing notification channel. + """Create or replace an existing Notification Channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -534,15 +560,17 @@ def create_or_update( notification_channel: Union[_models.NotificationChannel, IO], **kwargs: Any ) -> _models.NotificationChannel: - """Create or replace an existing notification channel. + """Create or replace an existing Notification Channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the notification channel. Required. :type name: str - :param notification_channel: A notification. Is either a model type or a IO type. Required. + :param notification_channel: A notification. Is either a NotificationChannel type or a IO type. + Required. :type notification_channel: ~azure.mgmt.devtestlabs.models.NotificationChannel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -563,16 +591,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationChannel] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotificationChannel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(notification_channel, (IO, bytes)): + if isinstance(notification_channel, (IOBase, bytes)): _content = notification_channel else: _json = self._serialize.body(notification_channel, "NotificationChannel") @@ -591,10 +617,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -610,11 +637,13 @@ def create_or_update( deserialized = self._deserialize("NotificationChannel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -622,7 +651,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete notification channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -644,10 +674,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -660,10 +688,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,15 +704,24 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}" + } @distributed_trace def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.NotificationChannel: """Allows modifying tags of notification channels. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -691,6 +729,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: NotificationChannel or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.NotificationChannel @@ -707,13 +747,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationChannel] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.NotificationChannel] = kwargs.pop("cls", None) - _notification_channel = _models.NotificationChannelFragment(tags=tags) + _notification_channel = _models.NotificationChannelFragment(identity=identity, tags=tags) _json = self._serialize.body(_notification_channel, "NotificationChannelFragment") request = build_update_request( @@ -729,10 +767,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -748,7 +787,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}" + } @distributed_trace def notify( # pylint: disable=inconsistent-return-statements @@ -762,14 +803,14 @@ def notify( # pylint: disable=inconsistent-return-statements ) -> None: """Send notification to provided channel. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the notification channel. Required. :type name: str - :param event_name: The type of event (i.e. AutoShutdown, Cost). Known values are: - "AutoShutdown" and "Cost". Default value is None. + :param event_name: The type of event (i.e. AutoShutdown). "AutoShutdown" Default value is None. :type event_name: str or ~azure.mgmt.devtestlabs.models.NotificationChannelEventType :param json_payload: Properties for the notification in json format. Default value is None. :type json_payload: str @@ -789,11 +830,9 @@ def notify( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _notify_parameters = _models.NotifyParameters(event_name=event_name, json_payload=json_payload) _json = self._serialize.body(_notify_parameters, "NotifyParameters") @@ -811,10 +850,11 @@ def notify( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -826,4 +866,6 @@ def notify( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - notify.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify"} # type: ignore + notify.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_operations.py index e229fd00656c..6e7fbd681405 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,7 @@ def build_get_request(location_name: str, name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,11 +48,13 @@ def build_get_request(location_name: str, name: str, subscription_id: str, **kwa ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "locationName": _SERIALIZER.url( + "location_name", location_name, "str", max_length=260, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,10 +108,8 @@ def get(self, location_name: str, name: str, **kwargs: Any) -> _models.Operation _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationResult] = kwargs.pop("cls", None) request = build_get_request( location_name=location_name, @@ -126,10 +121,11 @@ def get(self, location_name: str, name: str, **kwargs: Any) -> _models.Operation params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -138,15 +134,23 @@ def get(self, location_name: str, name: str, **kwargs: Any) -> _models.Operation map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("OperationResult", pipeline_response) if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + deserialized = self._deserialize("OperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_policies_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_policies_operations.py index c3a9b7da55e3..251ea0dc4418 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_policies_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_policies_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,12 +62,16 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "policySetName": _SERIALIZER.url("policy_set_name", policy_set_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -103,7 +103,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,13 +113,17 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "policySetName": _SERIALIZER.url("policy_set_name", policy_set_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -138,8 +142,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,13 +153,17 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "policySetName": _SERIALIZER.url("policy_set_name", policy_set_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,7 +182,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,13 +192,17 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "policySetName": _SERIALIZER.url("policy_set_name", policy_set_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,8 +219,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,13 +230,17 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "policySetName": _SERIALIZER.url("policy_set_name", policy_set_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -270,7 +286,8 @@ def list( ) -> Iterable["_models.Policy"]: """List policies in a given policy set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -279,8 +296,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=description)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -296,10 +313,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PolicyList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -327,7 +342,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -343,7 +358,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -351,14 +366,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PolicyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,7 +386,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies" + } @distributed_trace def get( @@ -384,7 +402,8 @@ def get( ) -> _models.Policy: """Get policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -411,10 +430,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -429,10 +446,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -448,7 +466,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}" + } @overload def create_or_update( @@ -464,7 +484,8 @@ def create_or_update( ) -> _models.Policy: """Create or replace an existing policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -497,7 +518,8 @@ def create_or_update( ) -> _models.Policy: """Create or replace an existing policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -528,7 +550,8 @@ def create_or_update( ) -> _models.Policy: """Create or replace an existing policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -536,7 +559,7 @@ def create_or_update( :type policy_set_name: str :param name: The name of the policy. Required. :type name: str - :param policy: A Policy. Is either a model type or a IO type. Required. + :param policy: A Policy. Is either a Policy type or a IO type. Required. :type policy: ~azure.mgmt.devtestlabs.models.Policy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -557,16 +580,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(policy, (IO, bytes)): + if isinstance(policy, (IOBase, bytes)): _content = policy else: _json = self._serialize.body(policy, "Policy") @@ -586,10 +607,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -605,11 +627,13 @@ def create_or_update( deserialized = self._deserialize("Policy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -617,7 +641,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -641,10 +666,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -658,10 +681,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -673,7 +697,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}" + } @distributed_trace def update( @@ -683,11 +709,13 @@ def update( policy_set_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Policy: """Allows modifying tags of policies. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -697,6 +725,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Policy or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Policy @@ -713,13 +743,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) - _policy = _models.PolicyFragment(tags=tags) + _policy = _models.PolicyFragment(identity=identity, tags=tags) _json = self._serialize.body(_policy, "PolicyFragment") request = build_update_request( @@ -736,10 +764,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -755,4 +784,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_policy_sets_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_policy_sets_operations.py index 93c6206b4e64..1be3da79a1ab 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_policy_sets_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_policy_sets_operations.py @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,6 +17,7 @@ ResourceNotModifiedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -26,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,14 +36,62 @@ _SERIALIZER.client_side_validation = False +def build_list_request( + resource_group_name: str, + lab_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_evaluate_policies_request( resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,12 +101,16 @@ def build_evaluate_policies_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,6 +142,115 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.PolicySet"]: + """List policy sets in a given lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicySet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devtestlabs.models.PolicySet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PolicySetList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PolicySetList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets" + } + @distributed_trace def evaluate_policies( self, @@ -104,7 +262,8 @@ def evaluate_policies( ) -> _models.EvaluatePoliciesResponse: """Evaluates lab policy. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -128,11 +287,9 @@ def evaluate_policies( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.EvaluatePoliciesResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.EvaluatePoliciesResponse] = kwargs.pop("cls", None) _evaluate_policies_request = _models.EvaluatePoliciesRequest(policies=policies) _json = self._serialize.body(_evaluate_policies_request, "EvaluatePoliciesRequest") @@ -150,10 +307,11 @@ def evaluate_policies( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -169,4 +327,6 @@ def evaluate_policies( return deserialized - evaluate_policies.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies"} # type: ignore + evaluate_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_provider_operations_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_provider_operations_operations.py index 0db3468d3906..75612db35f48 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_provider_operations_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_provider_operations_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +86,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationMetadata"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProviderOperationResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProviderOperationResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,14 +131,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProviderOperationResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,4 +151,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.DevTestLab/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DevTestLab/operations"} diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_schedules_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_schedules_operations.py index ebfa6b9636a1..4372873afee5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_schedules_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_schedules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,11 +63,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -102,7 +102,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,12 +112,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -136,8 +140,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,12 +151,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +179,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,12 +189,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,8 +215,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,12 +226,16 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,7 +254,7 @@ def build_execute_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,12 +264,16 @@ def build_execute_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -270,7 +290,7 @@ def build_list_applicable_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,12 +300,16 @@ def build_list_applicable_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -328,15 +352,16 @@ def list( ) -> Iterable["_models.Schedule"]: """List schedules in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -352,10 +377,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -382,7 +405,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -398,7 +421,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -406,14 +429,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,7 +449,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules" + } @distributed_trace def get( @@ -433,7 +459,8 @@ def get( ) -> _models.Schedule: """Get schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -458,10 +485,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -475,10 +500,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,7 +520,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}" + } @overload def create_or_update( @@ -509,7 +537,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -539,7 +568,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -562,13 +592,14 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the schedule. Required. :type name: str - :param schedule: A schedule. Is either a model type or a IO type. Required. + :param schedule: A schedule. Is either a Schedule type or a IO type. Required. :type schedule: ~azure.mgmt.devtestlabs.models.Schedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -589,16 +620,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(schedule, (IO, bytes)): + if isinstance(schedule, (IOBase, bytes)): _content = schedule else: _json = self._serialize.body(schedule, "Schedule") @@ -617,10 +646,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -636,11 +666,13 @@ def create_or_update( deserialized = self._deserialize("Schedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -648,7 +680,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -670,10 +703,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -686,10 +717,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -701,15 +733,24 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}" + } @distributed_trace def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.Schedule: """Allows modifying tags of schedules. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -717,6 +758,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Schedule @@ -733,13 +776,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _schedule = _models.ScheduleFragment(tags=tags) + _schedule = _models.ScheduleFragment(identity=identity, tags=tags) _json = self._serialize.body(_schedule, "ScheduleFragment") request = build_update_request( @@ -755,10 +796,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -774,7 +816,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}" + } def _execute_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -790,10 +834,8 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( resource_group_name=resource_group_name, @@ -806,10 +848,11 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -818,16 +861,26 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _execute_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute"} # type: ignore + _execute_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute" + } @distributed_trace def begin_execute(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Execute a schedule. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -848,13 +901,11 @@ def begin_execute(self, resource_group_name: str, lab_name: str, name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._execute_initial( # type: ignore resource_group_name=resource_group_name, @@ -873,7 +924,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -885,9 +938,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_execute.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute"} # type: ignore + begin_execute.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute" + } @distributed_trace def list_applicable( @@ -895,7 +950,8 @@ def list_applicable( ) -> Iterable["_models.Schedule"]: """Lists all applicable schedules. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -909,10 +965,8 @@ def list_applicable( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -936,7 +990,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -952,7 +1006,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -960,14 +1014,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -979,4 +1034,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_applicable.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable"} # type: ignore + list_applicable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_secrets_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_secrets_operations.py index e5a1dfd67fed..616455fa5b9f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_secrets_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_secrets_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,12 +64,16 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -105,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,13 +115,17 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -140,8 +144,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,13 +155,17 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,13 +194,17 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,8 +221,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,13 +232,17 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -272,7 +288,8 @@ def list( ) -> Iterable["_models.Secret"]: """List secrets in a given user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -281,8 +298,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=value)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -298,10 +315,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SecretList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -329,7 +344,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -345,7 +360,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,14 +368,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecretList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,7 +388,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets" + } @distributed_trace def get( @@ -386,7 +404,8 @@ def get( ) -> _models.Secret: """Get secret. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -413,10 +432,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -431,10 +448,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,7 +468,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } def _create_or_update_initial( self, @@ -472,16 +492,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(secret, (IO, bytes)): + if isinstance(secret, (IOBase, bytes)): _content = secret else: _json = self._serialize.body(secret, "Secret") @@ -501,10 +519,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,11 +539,13 @@ def _create_or_update_initial( deserialized = self._deserialize("Secret", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } @overload def begin_create_or_update( @@ -540,7 +561,8 @@ def begin_create_or_update( ) -> LROPoller[_models.Secret]: """Create or replace an existing secret. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -580,7 +602,8 @@ def begin_create_or_update( ) -> LROPoller[_models.Secret]: """Create or replace an existing secret. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -618,7 +641,8 @@ def begin_create_or_update( ) -> LROPoller[_models.Secret]: """Create or replace an existing secret. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -626,7 +650,7 @@ def begin_create_or_update( :type user_name: str :param name: The name of the secret. Required. :type name: str - :param secret: A secret. Is either a model type or a IO type. Required. + :param secret: A secret. Is either a Secret type or a IO type. Required. :type secret: ~azure.mgmt.devtestlabs.models.Secret or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -646,16 +670,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, user_name=user_name, @@ -677,7 +699,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -689,9 +713,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -699,7 +725,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete secret. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -723,10 +750,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -740,10 +765,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -755,7 +781,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } @distributed_trace def update( @@ -765,11 +793,13 @@ def update( user_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Secret: """Allows modifying tags of secrets. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -779,6 +809,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Secret or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Secret @@ -795,13 +827,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - _secret = _models.SecretFragment(tags=tags) + _secret = _models.SecretFragment(identity=identity, tags=tags) _json = self._serialize.body(_secret, "SecretFragment") request = build_update_request( @@ -818,10 +848,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -837,4 +868,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_fabric_schedules_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_fabric_schedules_operations.py index fe7a114806d0..7f197628030f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_fabric_schedules_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_fabric_schedules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +55,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,13 +65,17 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "serviceFabricName": _SERIALIZER.url("service_fabric_name", service_fabric_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -108,7 +108,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,14 +118,18 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "serviceFabricName": _SERIALIZER.url("service_fabric_name", service_fabric_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -150,8 +154,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -161,14 +165,18 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "serviceFabricName": _SERIALIZER.url("service_fabric_name", service_fabric_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -193,7 +201,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,14 +211,18 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "serviceFabricName": _SERIALIZER.url("service_fabric_name", service_fabric_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,8 +245,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,14 +256,18 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "serviceFabricName": _SERIALIZER.url("service_fabric_name", service_fabric_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,7 +292,7 @@ def build_execute_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,14 +302,18 @@ def build_execute_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "serviceFabricName": _SERIALIZER.url("service_fabric_name", service_fabric_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -338,7 +358,8 @@ def list( ) -> Iterable["_models.Schedule"]: """List schedules in a given service fabric. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -349,8 +370,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -366,10 +387,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -398,7 +417,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -414,7 +433,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -422,14 +441,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,7 +461,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules" + } @distributed_trace def get( @@ -456,7 +478,8 @@ def get( ) -> _models.Schedule: """Get schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -485,10 +508,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -504,10 +525,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,7 +545,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}" + } @overload def create_or_update( @@ -540,7 +564,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -576,7 +601,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -610,7 +636,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -620,7 +647,7 @@ def create_or_update( :type service_fabric_name: str :param name: The name of the schedule. Required. :type name: str - :param schedule: A schedule. Is either a model type or a IO type. Required. + :param schedule: A schedule. Is either a Schedule type or a IO type. Required. :type schedule: ~azure.mgmt.devtestlabs.models.Schedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -641,16 +668,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(schedule, (IO, bytes)): + if isinstance(schedule, (IOBase, bytes)): _content = schedule else: _json = self._serialize.body(schedule, "Schedule") @@ -671,10 +696,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -690,11 +716,13 @@ def create_or_update( deserialized = self._deserialize("Schedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -708,7 +736,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -734,10 +763,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -752,10 +779,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -767,7 +795,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}" + } @distributed_trace def update( @@ -778,11 +808,13 @@ def update( service_fabric_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Schedule: """Allows modifying tags of schedules. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -794,6 +826,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Schedule @@ -810,13 +844,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _schedule = _models.ScheduleFragment(tags=tags) + _schedule = _models.ScheduleFragment(identity=identity, tags=tags) _json = self._serialize.body(_schedule, "ScheduleFragment") request = build_update_request( @@ -834,10 +866,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -853,7 +886,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}" + } def _execute_initial( # pylint: disable=inconsistent-return-statements self, @@ -875,10 +910,8 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( resource_group_name=resource_group_name, @@ -893,10 +926,11 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -905,10 +939,19 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _execute_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute"} # type: ignore + _execute_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute" + } @distributed_trace def begin_execute( @@ -922,7 +965,8 @@ def begin_execute( ) -> LROPoller[None]: """Execute a schedule. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -947,13 +991,11 @@ def begin_execute( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._execute_initial( # type: ignore resource_group_name=resource_group_name, @@ -974,7 +1016,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -986,6 +1030,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_execute.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute"} # type: ignore + begin_execute.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_fabrics_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_fabrics_operations.py index 888b5d82df14..f1f8368defb7 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_fabrics_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_fabrics_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,12 +64,16 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -105,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,13 +115,17 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -140,8 +144,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,13 +155,17 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,13 +194,17 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,8 +221,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,13 +232,17 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,7 +261,7 @@ def build_list_applicable_schedules_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,13 +271,17 @@ def build_list_applicable_schedules_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -278,7 +298,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -288,13 +308,17 @@ def build_start_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -311,7 +335,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -321,13 +345,17 @@ def build_stop_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "userName": _SERIALIZER.url("user_name", user_name, "str"), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -371,7 +399,8 @@ def list( ) -> Iterable["_models.ServiceFabric"]: """List service fabrics in a given user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -380,8 +409,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -397,10 +426,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabricList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceFabricList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -428,7 +455,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -444,7 +471,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -452,14 +479,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ServiceFabricList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -471,7 +499,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics" + } @distributed_trace def get( @@ -485,7 +515,8 @@ def get( ) -> _models.ServiceFabric: """Get service fabric. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -512,10 +543,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabric] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceFabric] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -530,10 +559,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -549,7 +579,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } def _create_or_update_initial( self, @@ -571,16 +603,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabric] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceFabric] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(service_fabric, (IO, bytes)): + if isinstance(service_fabric, (IOBase, bytes)): _content = service_fabric else: _json = self._serialize.body(service_fabric, "ServiceFabric") @@ -600,10 +630,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -619,11 +650,13 @@ def _create_or_update_initial( deserialized = self._deserialize("ServiceFabric", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } @overload def begin_create_or_update( @@ -637,9 +670,10 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ServiceFabric]: - """Create or replace an existing service fabric. This operation can take a while to complete. + """Create or replace an existing Service Fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -678,9 +712,10 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ServiceFabric]: - """Create or replace an existing service fabric. This operation can take a while to complete. + """Create or replace an existing Service Fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -717,9 +752,10 @@ def begin_create_or_update( service_fabric: Union[_models.ServiceFabric, IO], **kwargs: Any ) -> LROPoller[_models.ServiceFabric]: - """Create or replace an existing service fabric. This operation can take a while to complete. + """Create or replace an existing Service Fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -727,7 +763,7 @@ def begin_create_or_update( :type user_name: str :param name: The name of the service fabric. Required. :type name: str - :param service_fabric: A Service Fabric. Is either a model type or a IO type. Required. + :param service_fabric: A Service Fabric. Is either a ServiceFabric type or a IO type. Required. :type service_fabric: ~azure.mgmt.devtestlabs.models.ServiceFabric or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -748,16 +784,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabric] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceFabric] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, user_name=user_name, @@ -779,7 +813,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -791,9 +827,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -809,10 +847,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -826,10 +862,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -838,10 +875,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } @distributed_trace def begin_delete( @@ -849,7 +895,8 @@ def begin_delete( ) -> LROPoller[None]: """Delete service fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -872,13 +919,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -898,7 +943,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -910,9 +957,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } @distributed_trace def update( @@ -922,11 +971,13 @@ def update( user_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.ServiceFabric: """Allows modifying tags of service fabrics. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -936,6 +987,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceFabric or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.ServiceFabric @@ -952,13 +1005,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceFabric] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.ServiceFabric] = kwargs.pop("cls", None) - _service_fabric = _models.ServiceFabricFragment(tags=tags) + _service_fabric = _models.ServiceFabricFragment(identity=identity, tags=tags) _json = self._serialize.body(_service_fabric, "ServiceFabricFragment") request = build_update_request( @@ -975,10 +1026,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -994,7 +1046,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}" + } @distributed_trace def list_applicable_schedules( @@ -1002,7 +1056,8 @@ def list_applicable_schedules( ) -> _models.ApplicableSchedule: """Lists the applicable start/stop schedules, if any. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1026,10 +1081,8 @@ def list_applicable_schedules( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicableSchedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicableSchedule] = kwargs.pop("cls", None) request = build_list_applicable_schedules_request( resource_group_name=resource_group_name, @@ -1043,10 +1096,11 @@ def list_applicable_schedules( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1062,7 +1116,9 @@ def list_applicable_schedules( return deserialized - list_applicable_schedules.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules"} # type: ignore + list_applicable_schedules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules" + } def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -1078,10 +1134,8 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1095,10 +1149,11 @@ def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1107,10 +1162,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start" + } @distributed_trace def begin_start( @@ -1118,7 +1182,8 @@ def begin_start( ) -> LROPoller[None]: """Start a service fabric. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1141,13 +1206,11 @@ def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1167,7 +1230,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1179,9 +1244,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start" + } def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, user_name: str, name: str, **kwargs: Any @@ -1197,10 +1264,8 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -1214,10 +1279,11 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1226,10 +1292,19 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop"} # type: ignore + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop" + } @distributed_trace def begin_stop( @@ -1237,7 +1312,8 @@ def begin_stop( ) -> LROPoller[None]: """Stop a service fabric This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1260,13 +1336,11 @@ def begin_stop( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -1286,7 +1360,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1298,6 +1374,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_runners_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_runners_operations.py index 1f9e6eeb337e..dc158136231c 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_runners_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_service_runners_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,21 +18,20 @@ ResourceNotModifiedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,13 +39,61 @@ _SERIALIZER.client_side_validation = False +def build_list_request( + resource_group_name: str, + lab_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_get_request( resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,12 +103,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,8 +129,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,12 +140,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,12 +178,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,11 +217,121 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ServiceRunner"]: + """List service runners in a given lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceRunner or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devtestlabs.models.ServiceRunner] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRunnerList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceRunnerList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners" + } + @distributed_trace def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> _models.ServiceRunner: """Get service runner. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -183,10 +353,8 @@ def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceRunner] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServiceRunner] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -199,10 +367,11 @@ def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -218,7 +387,9 @@ def get(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}" + } @overload def create_or_update( @@ -231,9 +402,10 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.ServiceRunner: - """Create or replace an existing service runner. + """Create or replace an existing Service runner. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -262,9 +434,10 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.ServiceRunner: - """Create or replace an existing service runner. + """Create or replace an existing Service runner. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -291,16 +464,17 @@ def create_or_update( service_runner: Union[_models.ServiceRunner, IO], **kwargs: Any ) -> _models.ServiceRunner: - """Create or replace an existing service runner. + """Create or replace an existing Service runner. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the service runner. Required. :type name: str :param service_runner: A container for a managed identity to execute DevTest lab services. Is - either a model type or a IO type. Required. + either a ServiceRunner type or a IO type. Required. :type service_runner: ~azure.mgmt.devtestlabs.models.ServiceRunner or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -321,16 +495,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ServiceRunner] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceRunner] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(service_runner, (IO, bytes)): + if isinstance(service_runner, (IOBase, bytes)): _content = service_runner else: _json = self._serialize.body(service_runner, "ServiceRunner") @@ -349,10 +521,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -368,29 +541,17 @@ def create_or_update( deserialized = self._deserialize("ServiceRunner", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}" + } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any ) -> None: - """Delete service runner. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param lab_name: The name of the lab. Required. - :type lab_name: str - :param name: The name of the service runner. Required. - :type 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: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -402,10 +563,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -413,24 +572,103 @@ def delete( # pylint: disable=inconsistent-return-statements name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Delete service runner. This operation can take a while to complete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the service runner. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"} # type: ignore + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_shared_galleries_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_shared_galleries_operations.py new file mode 100644 index 000000000000..8aebaafbe0a6 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_shared_galleries_operations.py @@ -0,0 +1,753 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + lab_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + lab_name: str, + name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class SharedGalleriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devtestlabs.DevTestLabsClient`'s + :attr:`shared_galleries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SharedGallery"]: + """List shared galleries in a given lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param expand: Specify the $expand query. Example: 'properties($select=identity)'. Default + value is None. + :type expand: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedGallery or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devtestlabs.models.SharedGallery] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedGalleryList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SharedGalleryList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries" + } + + @distributed_trace + def get( + self, resource_group_name: str, lab_name: str, name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.SharedGallery: + """Get shared gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param expand: Specify the $expand query. Example: 'properties($select=identity)'. Default + value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedGallery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + shared_gallery: _models.SharedGallery, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedGallery: + """Create or replace an existing Shared Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param shared_gallery: Properties of a shared gallery. Required. + :type shared_gallery: ~azure.mgmt.devtestlabs.models.SharedGallery + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + shared_gallery: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedGallery: + """Create or replace an existing Shared Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param shared_gallery: Properties of a shared gallery. Required. + :type shared_gallery: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + lab_name: str, + name: str, + shared_gallery: Union[_models.SharedGallery, IO], + **kwargs: Any + ) -> _models.SharedGallery: + """Create or replace an existing Shared Gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param shared_gallery: Properties of a shared gallery. Is either a SharedGallery type or a IO + type. Required. + :type shared_gallery: ~azure.mgmt.devtestlabs.models.SharedGallery or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shared_gallery, (IOBase, bytes)): + _content = shared_gallery + else: + _json = self._serialize.body(shared_gallery, "SharedGallery") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SharedGallery", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SharedGallery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any + ) -> None: + """Delete shared gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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.DevTestLab/labs/{labName}/sharedgalleries/{name}" + } + + @distributed_trace + def update( + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> _models.SharedGallery: + """Allows modifying tags of shared galleries. All other properties will be ignored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the shared gallery. Required. + :type name: str + :param tags: The tags of the resource. Default value is None. + :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedGallery or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedGallery + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.SharedGallery] = kwargs.pop("cls", None) + + _shared_gallery = _models.SharedGalleryFragment(identity=identity, tags=tags) + _json = self._serialize.body(_shared_gallery, "SharedGalleryFragment") + + request = build_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedGallery", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_shared_images_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_shared_images_operations.py new file mode 100644 index 000000000000..42ac0e175b7d --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_shared_images_operations.py @@ -0,0 +1,790 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "sharedGalleryName": _SERIALIZER.url("shared_gallery_name", shared_gallery_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "sharedGalleryName": _SERIALIZER.url("shared_gallery_name", shared_gallery_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, lab_name: str, shared_gallery_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "sharedGalleryName": _SERIALIZER.url("shared_gallery_name", shared_gallery_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, lab_name: str, shared_gallery_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "sharedGalleryName": _SERIALIZER.url("shared_gallery_name", shared_gallery_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, lab_name: str, shared_gallery_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "sharedGalleryName": _SERIALIZER.url("shared_gallery_name", shared_gallery_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class SharedImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.devtestlabs.DevTestLabsClient`'s + :attr:`shared_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SharedImage"]: + """List shared images in a given shared gallery. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param expand: Specify the $expand query. Example: 'properties($expand=versions)'. Default + value is None. + :type expand: str + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. + :type filter: str + :param top: The maximum number of resources to return from the operation. Example: '$top=10'. + Default value is None. + :type top: int + :param orderby: The ordering expression for the results, using OData notation. Example: + '$orderby=name desc'. Default value is None. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedImage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.devtestlabs.models.SharedImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedImageList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, + top=top, + orderby=orderby, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SharedImageList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.SharedImage: + """Get shared image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param expand: Specify the $expand query. Example: 'properties($expand=versions)'. Default + value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedImage] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + name=name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedImage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + shared_image: _models.SharedImage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedImage: + """Create or replace an existing Shared Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param shared_image: Properties of a shared image. Required. + :type shared_image: ~azure.mgmt.devtestlabs.models.SharedImage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + shared_image: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SharedImage: + """Create or replace an existing Shared Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param shared_image: Properties of a shared image. Required. + :type shared_image: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + shared_image: Union[_models.SharedImage, IO], + **kwargs: Any + ) -> _models.SharedImage: + """Create or replace an existing Shared Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param shared_image: Properties of a shared image. Is either a SharedImage type or a IO type. + Required. + :type shared_image: ~azure.mgmt.devtestlabs.models.SharedImage or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedImage] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shared_image, (IOBase, bytes)): + _content = shared_image + else: + _json = self._serialize.body(shared_image, "SharedImage") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SharedImage", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SharedImage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, shared_gallery_name: str, name: str, **kwargs: Any + ) -> None: + """Delete shared image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}" + } + + @distributed_trace + def update( + self, + resource_group_name: str, + lab_name: str, + shared_gallery_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any + ) -> _models.SharedImage: + """Allows modifying tags of shared images. All other properties will be ignored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param shared_gallery_name: The name of the shared gallery. Required. + :type shared_gallery_name: str + :param name: The name of the shared image. Required. + :type name: str + :param tags: The tags of the resource. Default value is None. + :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedImage or the result of cls(response) + :rtype: ~azure.mgmt.devtestlabs.models.SharedImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.SharedImage] = kwargs.pop("cls", None) + + _shared_image = _models.SharedImageFragment(identity=identity, tags=tags) + _json = self._serialize.body(_shared_image, "SharedImageFragment") + + request = build_update_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + shared_gallery_name=shared_gallery_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedImage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{sharedGalleryName}/sharedimages/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_users_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_users_operations.py index 8b8b6e66f360..0a2bdd146f28 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_users_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_users_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,11 +63,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -102,7 +102,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,12 +112,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -136,8 +140,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,12 +151,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +179,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,12 +189,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,8 +215,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,12 +226,16 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,15 +280,16 @@ def list( ) -> Iterable["_models.User"]: """List user profiles in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($select=identity)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -288,10 +305,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UserList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -318,7 +333,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -334,7 +349,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -342,14 +357,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UserList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,7 +377,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users" + } @distributed_trace def get( @@ -369,7 +387,8 @@ def get( ) -> _models.User: """Get user profile. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -394,10 +413,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.User] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.User] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -411,10 +428,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,10 +448,17 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } def _create_or_update_initial( - self, resource_group_name: str, lab_name: str, name: str, user: Union[_models.User, IO], **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + user: Optional[Union[_models.User, IO]] = None, + **kwargs: Any ) -> _models.User: error_map = { 401: ClientAuthenticationError, @@ -446,19 +471,20 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.User] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.User] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(user, (IO, bytes)): + if isinstance(user, (IOBase, bytes)): _content = user else: - _json = self._serialize.body(user, "User") + if user is not None: + _json = self._serialize.body(user, "User") + else: + _json = None request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -474,10 +500,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,11 +520,13 @@ def _create_or_update_initial( deserialized = self._deserialize("User", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } @overload def begin_create_or_update( @@ -505,20 +534,21 @@ def begin_create_or_update( resource_group_name: str, lab_name: str, name: str, - user: _models.User, + user: Optional[_models.User] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.User]: """Create or replace an existing user profile. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the user profile. Required. :type name: str - :param user: Profile of a lab user. Required. + :param user: Profile of a lab user. Default value is None. :type user: ~azure.mgmt.devtestlabs.models.User :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -542,20 +572,21 @@ def begin_create_or_update( resource_group_name: str, lab_name: str, name: str, - user: IO, + user: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.User]: """Create or replace an existing user profile. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the user profile. Required. :type name: str - :param user: Profile of a lab user. Required. + :param user: Profile of a lab user. Default value is None. :type user: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -575,17 +606,23 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, lab_name: str, name: str, user: Union[_models.User, IO], **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + user: Optional[Union[_models.User, IO]] = None, + **kwargs: Any ) -> LROPoller[_models.User]: """Create or replace an existing user profile. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the user profile. Required. :type name: str - :param user: Profile of a lab user. Is either a model type or a IO type. Required. + :param user: Profile of a lab user. Is either a User type or a IO type. Default value is None. :type user: ~azure.mgmt.devtestlabs.models.User or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -605,16 +642,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.User] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.User] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -635,7 +670,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -647,9 +684,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -665,10 +704,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -681,10 +718,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -693,16 +731,26 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } @distributed_trace def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Delete user profile. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -723,13 +771,11 @@ def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -748,7 +794,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -760,17 +808,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } @distributed_trace def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.User: """Allows modifying tags of user profiles. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -778,6 +835,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: User or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.User @@ -794,13 +853,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.User] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.User] = kwargs.pop("cls", None) - _user = _models.UserFragment(tags=tags) + _user = _models.UserFragment(identity=identity, tags=tags) _json = self._serialize.body(_user, "UserFragment") request = build_update_request( @@ -816,10 +873,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,4 +893,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_machine_schedules_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_machine_schedules_operations.py index 4bdf99893f48..a6726d1b5d60 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_machine_schedules_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_machine_schedules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +54,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,12 +64,23 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualMachineName": _SERIALIZER.url( + "virtual_machine_name", + virtual_machine_name, + "str", + max_length=62, + min_length=1, + pattern=r"^[a-zA-Z0-9\-]+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -105,7 +112,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,13 +122,24 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualMachineName": _SERIALIZER.url( + "virtual_machine_name", + virtual_machine_name, + "str", + max_length=62, + min_length=1, + pattern=r"^[a-zA-Z0-9\-]+$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -140,8 +158,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,13 +169,24 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualMachineName": _SERIALIZER.url( + "virtual_machine_name", + virtual_machine_name, + "str", + max_length=62, + min_length=1, + pattern=r"^[a-zA-Z0-9\-]+$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +205,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,13 +215,24 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualMachineName": _SERIALIZER.url( + "virtual_machine_name", + virtual_machine_name, + "str", + max_length=62, + min_length=1, + pattern=r"^[a-zA-Z0-9\-]+$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,8 +249,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,13 +260,24 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualMachineName": _SERIALIZER.url( + "virtual_machine_name", + virtual_machine_name, + "str", + max_length=62, + min_length=1, + pattern=r"^[a-zA-Z0-9\-]+$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,7 +296,7 @@ def build_execute_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -255,13 +306,24 @@ def build_execute_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "virtualMachineName": _SERIALIZER.url( + "virtual_machine_name", + virtual_machine_name, + "str", + max_length=62, + min_length=1, + pattern=r"^[a-zA-Z0-9\-]+$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,7 +367,8 @@ def list( ) -> Iterable["_models.Schedule"]: """List schedules in a given virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -314,8 +377,8 @@ def list( :param expand: Specify the $expand query. Example: 'properties($select=status)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -331,10 +394,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduleList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduleList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -362,7 +423,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -378,7 +439,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -386,14 +447,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,7 +467,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules" + } @distributed_trace def get( @@ -419,7 +483,8 @@ def get( ) -> _models.Schedule: """Get schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -446,10 +511,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -464,10 +527,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,7 +547,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}" + } @overload def create_or_update( @@ -499,7 +565,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -532,7 +599,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -563,7 +631,8 @@ def create_or_update( ) -> _models.Schedule: """Create or replace an existing schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -571,7 +640,7 @@ def create_or_update( :type virtual_machine_name: str :param name: The name of the schedule. Required. :type name: str - :param schedule: A schedule. Is either a model type or a IO type. Required. + :param schedule: A schedule. Is either a Schedule type or a IO type. Required. :type schedule: ~azure.mgmt.devtestlabs.models.Schedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -592,16 +661,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(schedule, (IO, bytes)): + if isinstance(schedule, (IOBase, bytes)): _content = schedule else: _json = self._serialize.body(schedule, "Schedule") @@ -621,10 +688,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,11 +708,13 @@ def create_or_update( deserialized = self._deserialize("Schedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -652,7 +722,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete schedule. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -676,10 +747,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -693,10 +762,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -708,7 +778,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}" + } @distributed_trace def update( @@ -718,11 +790,13 @@ def update( virtual_machine_name: str, name: str, tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, **kwargs: Any ) -> _models.Schedule: """Allows modifying tags of schedules. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -732,6 +806,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.Schedule @@ -748,13 +824,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Schedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - _schedule = _models.ScheduleFragment(tags=tags) + _schedule = _models.ScheduleFragment(identity=identity, tags=tags) _json = self._serialize.body(_schedule, "ScheduleFragment") request = build_update_request( @@ -771,10 +845,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +865,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}" + } def _execute_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, virtual_machine_name: str, name: str, **kwargs: Any @@ -806,10 +883,8 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( resource_group_name=resource_group_name, @@ -823,10 +898,11 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,10 +911,19 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _execute_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute"} # type: ignore + _execute_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute" + } @distributed_trace def begin_execute( @@ -846,7 +931,8 @@ def begin_execute( ) -> LROPoller[None]: """Execute a schedule. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -869,13 +955,11 @@ def begin_execute( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._execute_initial( # type: ignore resource_group_name=resource_group_name, @@ -895,7 +979,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -907,6 +993,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_execute.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute"} # type: ignore + begin_execute.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_machines_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_machines_operations.py index 88cf34480260..34a8c80d4148 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_machines_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_machines_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,11 +63,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -102,7 +102,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,12 +112,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -136,8 +140,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,12 +151,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +179,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,12 +189,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,8 +215,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,12 +226,16 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,8 +254,8 @@ def build_add_data_disk_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -249,12 +265,16 @@ def build_add_data_disk_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -273,8 +293,8 @@ def build_apply_artifacts_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,12 +304,16 @@ def build_apply_artifacts_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -308,7 +332,7 @@ def build_claim_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -318,12 +342,52 @@ def build_claim_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_clear_artifact_results_request( + resource_group_name: str, lab_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/clearArtifactResults", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -340,8 +404,8 @@ def build_detach_data_disk_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -351,12 +415,16 @@ def build_detach_data_disk_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -375,7 +443,7 @@ def build_get_rdp_file_contents_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -385,12 +453,16 @@ def build_get_rdp_file_contents_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -407,7 +479,7 @@ def build_list_applicable_schedules_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -417,12 +489,16 @@ def build_list_applicable_schedules_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -439,7 +515,7 @@ def build_redeploy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -449,12 +525,16 @@ def build_redeploy_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -471,8 +551,8 @@ def build_resize_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -482,12 +562,16 @@ def build_resize_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -506,7 +590,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -516,12 +600,16 @@ def build_restart_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -538,7 +626,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -548,12 +636,16 @@ def build_start_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -570,7 +662,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -580,12 +672,16 @@ def build_stop_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -602,7 +698,7 @@ def build_transfer_disks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -612,12 +708,16 @@ def build_transfer_disks_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -634,7 +734,7 @@ def build_un_claim_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -644,12 +744,16 @@ def build_un_claim_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -692,7 +796,8 @@ def list( ) -> Iterable["_models.LabVirtualMachine"]: """List virtual machines in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -700,8 +805,8 @@ def list( 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -717,10 +822,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachineList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabVirtualMachineList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -747,7 +850,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -763,7 +866,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -771,14 +874,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("LabVirtualMachineList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,7 +894,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines" + } @distributed_trace def get( @@ -798,7 +904,8 @@ def get( ) -> _models.LabVirtualMachine: """Get virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -824,10 +931,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachine] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabVirtualMachine] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -841,10 +946,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -860,7 +966,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } def _create_or_update_initial( self, @@ -881,16 +989,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachine] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabVirtualMachine] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(lab_virtual_machine, (IO, bytes)): + if isinstance(lab_virtual_machine, (IOBase, bytes)): _content = lab_virtual_machine else: _json = self._serialize.body(lab_virtual_machine, "LabVirtualMachine") @@ -909,10 +1015,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -928,11 +1035,13 @@ def _create_or_update_initial( deserialized = self._deserialize("LabVirtualMachine", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } @overload def begin_create_or_update( @@ -945,9 +1054,10 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LabVirtualMachine]: - """Create or replace an existing virtual machine. This operation can take a while to complete. + """Create or replace an existing Virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -983,9 +1093,10 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LabVirtualMachine]: - """Create or replace an existing virtual machine. This operation can take a while to complete. + """Create or replace an existing Virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1019,15 +1130,17 @@ def begin_create_or_update( lab_virtual_machine: Union[_models.LabVirtualMachine, IO], **kwargs: Any ) -> LROPoller[_models.LabVirtualMachine]: - """Create or replace an existing virtual machine. This operation can take a while to complete. + """Create or replace an existing Virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the virtual machine. Required. :type name: str - :param lab_virtual_machine: A virtual machine. Is either a model type or a IO type. Required. + :param lab_virtual_machine: A virtual machine. Is either a LabVirtualMachine type or a IO type. + Required. :type lab_virtual_machine: ~azure.mgmt.devtestlabs.models.LabVirtualMachine or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1048,16 +1161,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachine] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabVirtualMachine] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -1078,7 +1189,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1090,9 +1203,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -1108,10 +1223,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1124,10 +1237,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1136,16 +1250,26 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } @distributed_trace def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Delete virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1166,13 +1290,11 @@ def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1191,7 +1313,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1203,17 +1327,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } @distributed_trace def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.LabVirtualMachine: """Allows modifying tags of virtual machines. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1221,6 +1354,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: LabVirtualMachine or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.LabVirtualMachine @@ -1237,13 +1372,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LabVirtualMachine] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.LabVirtualMachine] = kwargs.pop("cls", None) - _lab_virtual_machine = _models.LabVirtualMachineFragment(tags=tags) + _lab_virtual_machine = _models.LabVirtualMachineFragment(identity=identity, tags=tags) _json = self._serialize.body(_lab_virtual_machine, "LabVirtualMachineFragment") request = build_update_request( @@ -1259,10 +1392,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1278,7 +1412,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}" + } def _add_data_disk_initial( # pylint: disable=inconsistent-return-statements self, @@ -1299,16 +1435,14 @@ def _add_data_disk_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_disk_properties, (IO, bytes)): + if isinstance(data_disk_properties, (IOBase, bytes)): _content = data_disk_properties else: _json = self._serialize.body(data_disk_properties, "DataDiskProperties") @@ -1327,10 +1461,11 @@ def _add_data_disk_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1339,10 +1474,19 @@ def _add_data_disk_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _add_data_disk_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk"} # type: ignore + _add_data_disk_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk" + } @overload def begin_add_data_disk( @@ -1358,7 +1502,8 @@ def begin_add_data_disk( """Attach a new or existing data disk to virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1397,7 +1542,8 @@ def begin_add_data_disk( """Attach a new or existing data disk to virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1434,14 +1580,15 @@ def begin_add_data_disk( """Attach a new or existing data disk to virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the virtual machine. Required. :type name: str :param data_disk_properties: Request body for adding a new or existing data disk to a virtual - machine. Is either a model type or a IO type. Required. + machine. Is either a DataDiskProperties type or a IO type. Required. :type data_disk_properties: ~azure.mgmt.devtestlabs.models.DataDiskProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1461,14 +1608,12 @@ def begin_add_data_disk( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._add_data_disk_initial( # type: ignore resource_group_name=resource_group_name, @@ -1489,7 +1634,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1501,9 +1648,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_add_data_disk.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk"} # type: ignore + begin_add_data_disk.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk" + } def _apply_artifacts_initial( # pylint: disable=inconsistent-return-statements self, @@ -1524,11 +1673,9 @@ def _apply_artifacts_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _apply_artifacts_request = _models.ApplyArtifactsRequest(artifacts=artifacts) _json = self._serialize.body(_apply_artifacts_request, "ApplyArtifactsRequest") @@ -1546,10 +1693,11 @@ def _apply_artifacts_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1558,10 +1706,19 @@ def _apply_artifacts_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _apply_artifacts_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts"} # type: ignore + _apply_artifacts_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts" + } @distributed_trace def begin_apply_artifacts( @@ -1574,7 +1731,8 @@ def begin_apply_artifacts( ) -> LROPoller[None]: """Apply artifacts to virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1597,14 +1755,12 @@ def begin_apply_artifacts( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._apply_artifacts_initial( # type: ignore resource_group_name=resource_group_name, @@ -1625,7 +1781,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1637,9 +1795,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_apply_artifacts.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts"} # type: ignore + begin_apply_artifacts.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts" + } def _claim_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -1655,10 +1815,8 @@ def _claim_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_claim_request( resource_group_name=resource_group_name, @@ -1671,10 +1829,11 @@ def _claim_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1683,16 +1842,26 @@ def _claim_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _claim_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim"} # type: ignore + _claim_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim" + } @distributed_trace def begin_claim(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Take ownership of an existing virtual machine This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1713,13 +1882,11 @@ def begin_claim(self, resource_group_name: str, lab_name: str, name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._claim_initial( # type: ignore resource_group_name=resource_group_name, @@ -1738,7 +1905,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1750,9 +1919,74 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_claim.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim"} # type: ignore + begin_claim.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim" + } + + @distributed_trace + def clear_artifact_results( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any + ) -> None: + """Clears the artifact results of the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param lab_name: The name of the lab. Required. + :type lab_name: str + :param name: The name of the virtual machine. Required. + :type 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_clear_artifact_results_request( + resource_group_name=resource_group_name, + lab_name=lab_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.clear_artifact_results.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + clear_artifact_results.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/clearArtifactResults" + } def _detach_data_disk_initial( # pylint: disable=inconsistent-return-statements self, @@ -1773,11 +2007,9 @@ def _detach_data_disk_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _detach_data_disk_properties = _models.DetachDataDiskProperties(existing_lab_disk_id=existing_lab_disk_id) _json = self._serialize.body(_detach_data_disk_properties, "DetachDataDiskProperties") @@ -1795,10 +2027,11 @@ def _detach_data_disk_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1807,10 +2040,19 @@ def _detach_data_disk_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _detach_data_disk_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk"} # type: ignore + _detach_data_disk_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk" + } @distributed_trace def begin_detach_data_disk( @@ -1824,7 +2066,8 @@ def begin_detach_data_disk( """Detach the specified disk from the virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1848,14 +2091,12 @@ def begin_detach_data_disk( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._detach_data_disk_initial( # type: ignore resource_group_name=resource_group_name, @@ -1876,7 +2117,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1888,9 +2131,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_detach_data_disk.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk"} # type: ignore + begin_detach_data_disk.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk" + } @distributed_trace def get_rdp_file_contents( @@ -1898,7 +2143,8 @@ def get_rdp_file_contents( ) -> _models.RdpConnection: """Gets a string that represents the contents of the RDP file for the virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1920,10 +2166,8 @@ def get_rdp_file_contents( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RdpConnection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RdpConnection] = kwargs.pop("cls", None) request = build_get_rdp_file_contents_request( resource_group_name=resource_group_name, @@ -1936,10 +2180,11 @@ def get_rdp_file_contents( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1955,7 +2200,9 @@ def get_rdp_file_contents( return deserialized - get_rdp_file_contents.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents"} # type: ignore + get_rdp_file_contents.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents" + } @distributed_trace def list_applicable_schedules( @@ -1963,7 +2210,8 @@ def list_applicable_schedules( ) -> _models.ApplicableSchedule: """Lists the applicable start/stop schedules, if any. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -1985,10 +2233,8 @@ def list_applicable_schedules( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicableSchedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicableSchedule] = kwargs.pop("cls", None) request = build_list_applicable_schedules_request( resource_group_name=resource_group_name, @@ -2001,10 +2247,11 @@ def list_applicable_schedules( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2020,7 +2267,9 @@ def list_applicable_schedules( return deserialized - list_applicable_schedules.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules"} # type: ignore + list_applicable_schedules.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules" + } def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -2036,10 +2285,8 @@ def _redeploy_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_redeploy_request( resource_group_name=resource_group_name, @@ -2052,10 +2299,11 @@ def _redeploy_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2064,16 +2312,26 @@ def _redeploy_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _redeploy_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy"} # type: ignore + _redeploy_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy" + } @distributed_trace def begin_redeploy(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Redeploy a virtual machine This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2094,13 +2352,11 @@ def begin_redeploy(self, resource_group_name: str, lab_name: str, name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._redeploy_initial( # type: ignore resource_group_name=resource_group_name, @@ -2119,7 +2375,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2131,9 +2389,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_redeploy.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy"} # type: ignore + begin_redeploy.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy" + } def _resize_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, size: Optional[str] = None, **kwargs: Any @@ -2149,11 +2409,9 @@ def _resize_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _resize_lab_virtual_machine_properties = _models.ResizeLabVirtualMachineProperties(size=size) _json = self._serialize.body(_resize_lab_virtual_machine_properties, "ResizeLabVirtualMachineProperties") @@ -2171,10 +2429,11 @@ def _resize_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2183,10 +2442,19 @@ def _resize_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _resize_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize"} # type: ignore + _resize_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize" + } @distributed_trace def begin_resize( @@ -2194,7 +2462,8 @@ def begin_resize( ) -> LROPoller[None]: """Resize Virtual Machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2217,14 +2486,12 @@ def begin_resize( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._resize_initial( # type: ignore resource_group_name=resource_group_name, @@ -2245,7 +2512,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2257,9 +2526,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_resize.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize"} # type: ignore + begin_resize.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize" + } def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -2275,10 +2546,8 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( resource_group_name=resource_group_name, @@ -2291,10 +2560,11 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2303,16 +2573,26 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _restart_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart"} # type: ignore + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart" + } @distributed_trace def begin_restart(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Restart a virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2333,13 +2613,11 @@ def begin_restart(self, resource_group_name: str, lab_name: str, name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._restart_initial( # type: ignore resource_group_name=resource_group_name, @@ -2358,7 +2636,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2370,9 +2650,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart"} # type: ignore + begin_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart" + } def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -2388,10 +2670,8 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -2404,10 +2684,11 @@ def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2416,16 +2697,26 @@ def _start_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start"} # type: ignore + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start" + } @distributed_trace def begin_start(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Start a virtual machine. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2446,13 +2737,11 @@ def begin_start(self, resource_group_name: str, lab_name: str, name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -2471,7 +2760,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2483,9 +2774,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start" + } def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -2501,10 +2794,8 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -2517,10 +2808,11 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2529,16 +2821,26 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop"} # type: ignore + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop" + } @distributed_trace def begin_stop(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Stop a virtual machine This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2559,13 +2861,11 @@ def begin_stop(self, resource_group_name: str, lab_name: str, name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -2584,7 +2884,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2596,9 +2898,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop" + } def _transfer_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -2614,10 +2918,8 @@ def _transfer_disks_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_transfer_disks_request( resource_group_name=resource_group_name, @@ -2630,10 +2932,11 @@ def _transfer_disks_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2642,10 +2945,19 @@ def _transfer_disks_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _transfer_disks_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks"} # type: ignore + _transfer_disks_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks" + } @distributed_trace def begin_transfer_disks( @@ -2654,7 +2966,8 @@ def begin_transfer_disks( """Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2675,13 +2988,11 @@ def begin_transfer_disks( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._transfer_disks_initial( # type: ignore resource_group_name=resource_group_name, @@ -2700,7 +3011,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2712,9 +3025,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_transfer_disks.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks"} # type: ignore + begin_transfer_disks.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks" + } def _un_claim_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -2730,10 +3045,8 @@ def _un_claim_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_un_claim_request( resource_group_name=resource_group_name, @@ -2746,10 +3059,11 @@ def _un_claim_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2758,16 +3072,26 @@ def _un_claim_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _un_claim_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim"} # type: ignore + _un_claim_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim" + } @distributed_trace def begin_un_claim(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Release ownership of an existing virtual machine This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -2788,13 +3112,11 @@ def begin_un_claim(self, resource_group_name: str, lab_name: str, name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._un_claim_initial( # type: ignore resource_group_name=resource_group_name, @@ -2813,7 +3135,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -2825,6 +3149,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_un_claim.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim"} # type: ignore + begin_un_claim.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_networks_operations.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_networks_operations.py index af9454018320..87e66b80e3c5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_networks_operations.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,11 +63,15 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -102,7 +102,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,12 +112,16 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if expand is not None: @@ -136,8 +140,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,12 +151,16 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +179,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,12 +189,16 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,8 +215,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-15")) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,12 +226,16 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "labName": _SERIALIZER.url("lab_name", lab_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "labName": _SERIALIZER.url( + "lab_name", lab_name, "str", max_length=50, min_length=1, pattern=r"^[a-zA-Z0-9_\-]+$" + ), "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,15 +280,16 @@ def list( ) -> Iterable["_models.VirtualNetwork"]: """List virtual networks in a given lab. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param expand: Specify the $expand query. Example: 'properties($expand=externalSubnets)'. Default value is None. :type expand: str - :param filter: The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - Default value is None. + :param filter: The filter to apply to the operation. Example: + '$filter=contains(name,'myName')'. Default value is None. :type filter: str :param top: The maximum number of resources to return from the operation. Example: '$top=10'. Default value is None. @@ -288,10 +305,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetworkList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetworkList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -318,7 +333,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -334,7 +349,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -342,14 +357,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,7 +377,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks" + } @distributed_trace def get( @@ -369,7 +387,8 @@ def get( ) -> _models.VirtualNetwork: """Get virtual network. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -394,10 +413,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetwork] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -411,10 +428,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,7 +448,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } def _create_or_update_initial( self, @@ -451,16 +471,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetwork] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtual_network, (IO, bytes)): + if isinstance(virtual_network, (IOBase, bytes)): _content = virtual_network else: _json = self._serialize.body(virtual_network, "VirtualNetwork") @@ -479,10 +497,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,11 +517,13 @@ def _create_or_update_initial( deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } @overload def begin_create_or_update( @@ -517,7 +538,8 @@ def begin_create_or_update( ) -> LROPoller[_models.VirtualNetwork]: """Create or replace an existing virtual network. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -555,7 +577,8 @@ def begin_create_or_update( ) -> LROPoller[_models.VirtualNetwork]: """Create or replace an existing virtual network. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -591,13 +614,15 @@ def begin_create_or_update( ) -> LROPoller[_models.VirtualNetwork]: """Create or replace an existing virtual network. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str :param name: The name of the virtual network. Required. :type name: str - :param virtual_network: A virtual network. Is either a model type or a IO type. Required. + :param virtual_network: A virtual network. Is either a VirtualNetwork type or a IO type. + Required. :type virtual_network: ~azure.mgmt.devtestlabs.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -618,16 +643,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetwork] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, lab_name=lab_name, name=name, @@ -648,7 +671,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -660,9 +685,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any @@ -678,10 +705,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -694,10 +719,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -706,16 +732,26 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } @distributed_trace def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Delete virtual network. This operation can take a while to complete. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -736,13 +772,11 @@ def begin_delete(self, resource_group_name: str, lab_name: str, name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -761,7 +795,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -773,17 +809,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } @distributed_trace def update( - self, resource_group_name: str, lab_name: str, name: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any + self, + resource_group_name: str, + lab_name: str, + name: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional[_models.IdentityProperties] = None, + **kwargs: Any ) -> _models.VirtualNetwork: """Allows modifying tags of virtual networks. All other properties will be ignored. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param lab_name: The name of the lab. Required. :type lab_name: str @@ -791,6 +836,8 @@ def update( :type name: str :param tags: The tags of the resource. Default value is None. :type tags: dict[str, str] + :param identity: The identity of the resource. Default value is None. + :type identity: ~azure.mgmt.devtestlabs.models.IdentityProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetwork or the result of cls(response) :rtype: ~azure.mgmt.devtestlabs.models.VirtualNetwork @@ -807,13 +854,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2018-09-15"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.VirtualNetwork] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) - _virtual_network = _models.VirtualNetworkFragment(tags=tags) + _virtual_network = _models.VirtualNetworkFragment(identity=identity, tags=tags) _json = self._serialize.body(_virtual_network, "VirtualNetworkFragment") request = build_update_request( @@ -829,10 +874,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -848,4 +894,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}" + } diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/arm_templates_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/arm_templates_get.py index 732df091c0d9..e6d37d6a20e4 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/arm_templates_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/arm_templates_get.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.arm_templates.get( resource_group_name="resourceGroupName", - lab_name="{labName}", - artifact_source_name="{artifactSourceName}", + lab_name="myLabName", + artifact_source_name="myArtifactSource", name="{armTemplateName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ArmTemplates_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/arm_templates_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/arm_templates_list.py index 567af68cd353..05bef121d1e1 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/arm_templates_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/arm_templates_list.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.arm_templates.list( resource_group_name="resourceGroupName", - lab_name="{labName}", - artifact_source_name="{artifactSourceName}", + lab_name="myLabName", + artifact_source_name="myArtifactSource", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ArmTemplates_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_create_or_update.py index 95cb83c42a82..b18478cd66c7 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_create_or_update.py @@ -26,22 +26,23 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.artifact_sources.create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="{artifactSourceName}", + lab_name="myLabName", + name="myArtifactSource", artifact_source={ + "location": "{location}", "properties": { "armTemplateFolderPath": "{armTemplateFolderPath}", "branchRef": "{branchRef}", "displayName": "{displayName}", "folderPath": "{folderPath}", "securityToken": "{securityToken}", - "sourceType": "{VsoGit|GitHub|StorageAccount}", - "status": "{Enabled|Disabled}", + "sourceType": "{sourceType}", + "status": "{status}", "uri": "{artifactSourceUri}", }, "tags": {"tagName1": "tagValue1"}, @@ -50,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ArtifactSources_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_delete.py index 9757364ab86d..69745753b219 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.artifact_sources.delete( + client.artifact_sources.delete( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="{artifactSourceName}", + lab_name="myLabName", + name="myArtifactSource", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ArtifactSources_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_get.py index ecadac32b200..a0ae932afe04 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.artifact_sources.get( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="{artifactSourceName}", + lab_name="myLabName", + name="myArtifactSource", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ArtifactSources_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_list.py index b71c05d8b648..2375db4f2ef7 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.artifact_sources.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ArtifactSources_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_update.py index 7ce39fd2740d..c707e838a781 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifact_sources_update.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.artifact_sources.update( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="{artifactSourceName}", + lab_name="myLabName", + name="myArtifactSource", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ArtifactSources_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_generate_arm_template.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_generate_arm_template.py index a003c705a73f..374309ed18fb 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_generate_arm_template.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_generate_arm_template.py @@ -26,13 +26,13 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.artifacts.generate_arm_template( resource_group_name="resourceGroupName", - lab_name="{labName}", - artifact_source_name="{artifactSourceName}", + lab_name="myLabName", + artifact_source_name="myArtifactSource", name="{artifactName}", generate_arm_template_request={ "fileUploadOptions": "None", @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_GenerateArmTemplate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Artifacts_GenerateArmTemplate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_get.py index ef632c0ebd2b..999fc09ea8f3 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_get.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.artifacts.get( resource_group_name="resourceGroupName", - lab_name="{labName}", - artifact_source_name="{artifactSourceName}", + lab_name="myLabName", + artifact_source_name="myArtifactSource", name="{artifactName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Artifacts_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_list.py index b94a8032ae82..b982132bb6e4 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/artifacts_list.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.artifacts.list( resource_group_name="resourceGroupName", - lab_name="{labName}", - artifact_source_name="{artifactSourceName}", + lab_name="myLabName", + artifact_source_name="myArtifactSource", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Artifacts_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_delete.py new file mode 100644 index 000000000000..a71b19b60994 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python bastion_hosts_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.bastion_hosts.begin_delete( + resource_group_name="resourceGroupName", + lab_name="myLabName", + virtual_network_name="labVirtualNetwork", + name="{bastionHostName}", + ).result() + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/BastionHosts_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_get.py new file mode 100644 index 000000000000..daf07be6e339 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python bastion_hosts_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.bastion_hosts.get( + resource_group_name="resourceGroupName", + lab_name="myLabName", + virtual_network_name="labVirtualNetwork", + name="{bastionHostName}", + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/BastionHosts_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_list.py new file mode 100644 index 000000000000..ea08f9fb753c --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python bastion_hosts_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.bastion_hosts.list( + resource_group_name="resourceGroupName", + lab_name="myLabName", + virtual_network_name="labVirtualNetwork", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/BastionHosts_List.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_update.py new file mode 100644 index 000000000000..5ad2c9c64abc --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/bastion_hosts_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python bastion_hosts_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.bastion_hosts.update( + resource_group_name="resourceGroupName", + lab_name="myLabName", + virtual_network_name="labVirtualNetwork", + name="{bastionHostName}", + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/BastionHosts_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/costs_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/costs_create_or_update.py deleted file mode 100644 index ff82e146e980..000000000000 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/costs_create_or_update.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.devtestlabs import DevTestLabsClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-devtestlabs -# USAGE - python costs_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DevTestLabsClient( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.costs.create_or_update( - resource_group_name="resourceGroupName", - lab_name="{labName}", - name="targetCost", - lab_cost={ - "properties": { - "currencyCode": "USD", - "endDateTime": "2020-12-31T23:59:59Z", - "startDateTime": "2020-12-01T00:00:00Z", - "targetCost": { - "costThresholds": [ - { - "displayOnChart": "Disabled", - "percentageThreshold": {"thresholdValue": 25}, - "sendNotificationWhenExceeded": "Disabled", - "thresholdId": "00000000-0000-0000-0000-000000000001", - }, - { - "displayOnChart": "Enabled", - "percentageThreshold": {"thresholdValue": 50}, - "sendNotificationWhenExceeded": "Enabled", - "thresholdId": "00000000-0000-0000-0000-000000000002", - }, - { - "displayOnChart": "Disabled", - "percentageThreshold": {"thresholdValue": 75}, - "sendNotificationWhenExceeded": "Disabled", - "thresholdId": "00000000-0000-0000-0000-000000000003", - }, - { - "displayOnChart": "Disabled", - "percentageThreshold": {"thresholdValue": 100}, - "sendNotificationWhenExceeded": "Disabled", - "thresholdId": "00000000-0000-0000-0000-000000000004", - }, - { - "displayOnChart": "Disabled", - "percentageThreshold": {"thresholdValue": 125}, - "sendNotificationWhenExceeded": "Disabled", - "thresholdId": "00000000-0000-0000-0000-000000000005", - }, - ], - "cycleEndDateTime": "2020-12-31T00:00:00.000Z", - "cycleStartDateTime": "2020-12-01T00:00:00.000Z", - "cycleType": "CalendarMonth", - "status": "Enabled", - "target": 100, - }, - } - }, - ) - print(response) - - -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_create_or_update.py index 93c27f17e068..b6433e725fce 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_create_or_update.py @@ -26,19 +26,20 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.custom_images.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{customImageName}", custom_image={ + "location": "{location}", "properties": { "description": "My Custom Image", "vm": { "linuxOsInfo": {"linuxOsState": "NonDeprovisioned"}, - "sourceVmId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}", + "sourceVmId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/myLabName/virtualmachines/{vmName}", }, }, "tags": {"tagName1": "tagValue1"}, @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/CustomImages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_delete.py index 3a595928e3b2..7d4347302025 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.custom_images.begin_delete( + client.custom_images.begin_delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{customImageName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/CustomImages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_get.py index f4201dc637ea..d35bbbd7aa62 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.custom_images.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{customImageName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/CustomImages_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_list.py index 146137b70d06..67e7e5b27e1b 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.custom_images.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/CustomImages_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_update.py index 2d8db559ca44..60d2188dbe99 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/custom_images_update.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.custom_images.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{customImageName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/CustomImages_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_attach.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_attach.py index 9e840d33f90e..416d1ee32e67 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_attach.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_attach.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.disks.begin_attach( + client.disks.begin_attach( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userId}", name="{diskName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Attach.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Disks_Attach.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_create_or_update.py index e702ea503967..efec91f64119 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_create_or_update.py @@ -26,25 +26,26 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.disks.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userId}", name="{diskName}", disk={ + "location": "{location}", "properties": { "diskSizeGiB": 1023, "diskType": "Standard", - "leasedByLabVmId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/vmName", - } + "leasedByLabVmId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/myLabName/virtualmachines/vmName", + }, }, ).result() print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Disks_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_delete.py index 1faeda54163e..523272678e54 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_delete.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.disks.begin_delete( + client.disks.begin_delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userId}", name="{diskName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Disks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_detach.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_detach.py index 682b8509b0bb..0cc30c8b85b9 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_detach.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_detach.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.disks.begin_detach( + client.disks.begin_detach( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userId}", name="{diskName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Detach.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Disks_Detach.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_get.py index 58f87e853d35..dd75fa268fc8 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_get.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.disks.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", name="{diskName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Disks_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_list.py index daec7331626d..6dca3090ad03 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_list.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.disks.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Disks_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_update.py index da492ab7a2ab..c288a71fa57f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/disks_update.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.disks.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", name="diskName", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Disks_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_create_or_update.py index 0fd602e59468..65b23092ab85 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_create_or_update.py @@ -26,26 +26,27 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.environments.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", name="{environmentName}", dtl_environment={ + "location": "southeastasia", "properties": { "deploymentProperties": { - "armTemplateId": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/{artifactSourceName}/armTemplates/{armTemplateName}", + "armTemplateId": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/myLabName/artifactSources/myArtifactSource/armTemplates/{armTemplateName}", "parameters": [], } - } + }, }, ).result() print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Environments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_delete.py index a1a7d0b937ce..1a8733fee375 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_delete.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.environments.begin_delete( + client.environments.begin_delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", name="{environmentName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Environments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_get.py index 3e676829a6ba..197d620b12a1 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_get.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.environments.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", name="{environmentName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Environments_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_list.py index 616f63297df7..d4e5713355f4 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_list.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.environments.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Environments_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_update.py index ef2673ddb54f..a398203efc4d 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/environments_update.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.environments.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", name="{environmentName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Environments_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_create_or_update.py index 24c94f81b697..8b5eb02d0a3a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_create_or_update.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.formulas.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{formulaName}", formula={ "location": "{location}", @@ -43,7 +43,7 @@ def main(): "allowClaim": False, "artifacts": [ { - "artifactId": "/artifactsources/{artifactSourceName}/artifacts/linux-install-nodejs", + "artifactId": "/artifactsources/myArtifactSource/artifacts/linux-install-nodejs", "parameters": [], } ], @@ -56,8 +56,8 @@ def main(): "version": "latest", }, "isAuthenticationWithSshKey": False, - "labSubnetName": "Dtl{labName}Subnet", - "labVirtualNetworkId": "/virtualnetworks/dtl{labName}", + "labSubnetName": "DtlmyLabNameSubnet", + "labVirtualNetworkId": "/virtualnetworks/dtlmyLabName", "networkInterface": { "sharedPublicIpAddressConfiguration": { "inboundNatRules": [{"backendPort": 22, "transportProtocol": "Tcp"}] @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Formulas_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_delete.py index 939f2bb1b759..edc002c1fee5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.formulas.delete( + client.formulas.delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{formulaName}", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Formulas_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_get.py index 811c20ebc9bb..e3884d05a0e5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.formulas.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{formulaName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Formulas_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_list.py index 8de7b28b62f1..b6dc2576ae1a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.formulas.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Formulas_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_update.py index ec6cc59d86b7..bc5586991108 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/formulas_update.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.formulas.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{formulaName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Formulas_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/gallery_images_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/gallery_images_get.py new file mode 100644 index 000000000000..3e6ae204406b --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/gallery_images_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python gallery_images_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.gallery_images.get( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{name}", + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GalleryImages_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/gallery_images_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/gallery_images_list.py index 87bbd2035846..755aba9cee6b 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/gallery_images_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/gallery_images_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.gallery_images.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GalleryImages_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GalleryImages_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_create_or_update.py index 8a870e99a5d4..fe16d93db278 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_create_or_update.py @@ -26,13 +26,14 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.global_schedules.create_or_update( resource_group_name="resourceGroupName", name="labvmautostart", schedule={ + "location": "southeastasia", "properties": { "status": "Enabled", "taskType": "LabVmsStartupTask", @@ -41,12 +42,12 @@ def main(): "time": "0700", "weekdays": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], }, - } + }, }, ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GlobalSchedules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_delete.py index 62744af4e38d..6f56dceb2edf 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_delete.py @@ -26,16 +26,15 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.global_schedules.delete( + client.global_schedules.delete( resource_group_name="resourceGroupName", name="labvmautostart", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GlobalSchedules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_execute.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_execute.py index 4fd66179a15a..64986aabbaa5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_execute.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_execute.py @@ -26,16 +26,15 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.global_schedules.begin_execute( + client.global_schedules.begin_execute( resource_group_name="resourceGroupName", name="labvmautostart", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Execute.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GlobalSchedules_Execute.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_get.py index 42f4659e55d1..8440a2cbcb5a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_get.py @@ -26,7 +26,7 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.global_schedules.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GlobalSchedules_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_list_by_resource_group.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_list_by_resource_group.py index 0037b668c8c6..b5794febdcbd 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_list_by_resource_group.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_list_by_resource_group.py @@ -26,7 +26,7 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.global_schedules.list_by_resource_group( @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListByResourceGroup.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GlobalSchedules_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_list_by_subscription.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_list_by_subscription.py index e4815d3c35c5..fdddce857fc7 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_list_by_subscription.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_list_by_subscription.py @@ -26,7 +26,7 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.global_schedules.list_by_subscription() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListBySubscription.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GlobalSchedules_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_retarget.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_retarget.py index 79651d75e2d7..12ff16c12ace 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_retarget.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_retarget.py @@ -26,16 +26,15 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.global_schedules.begin_retarget( + client.global_schedules.begin_retarget( resource_group_name="resourceGroupName", name="{scheduleName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Retarget.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GlobalSchedules_Retarget.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_update.py index 66f159ce168c..ffdd97c43528 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/global_schedules_update.py @@ -26,7 +26,7 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.global_schedules.update( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/GlobalSchedules_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_create_or_update.py new file mode 100644 index 000000000000..b1ee2e6be833 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_create_or_update.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python lab_secrets_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.lab_secrets.begin_create_or_update( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{secretName}", + lab_secret={ + "location": "{location}", + "properties": { + "enabledForArmEnvironments": True, + "enabledForArtifacts": True, + "enabledForVmCreation": True, + "value": "{secretValue}", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/LabSecrets_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_delete.py new file mode 100644 index 000000000000..cc4930095cda --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python lab_secrets_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.lab_secrets.begin_delete( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{secretName}", + ).result() + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/LabSecrets_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/costs_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_get.py similarity index 83% rename from sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/costs_get.py rename to sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_get.py index f5de5aa7a75f..93de20afc862 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/costs_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-devtestlabs # USAGE - python costs_get.py + python lab_secrets_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.costs.get( + response = client.lab_secrets.get( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="targetCost", + lab_name="myLabName", + name="labSecretName", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/LabSecrets_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_list.py new file mode 100644 index 000000000000..4926ba8f4795 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python lab_secrets_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.lab_secrets.list( + resource_group_name="resourceGroupName", + lab_name="myLabName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/LabSecrets_List.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_update.py new file mode 100644 index 000000000000..ee484cfba1f7 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/lab_secrets_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python lab_secrets_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.lab_secrets.begin_update( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{secretName}", + ).result() + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/LabSecrets_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_claim_any_vm.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_claim_any_vm.py index 745784fb0c58..991ab930ee9c 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_claim_any_vm.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_claim_any_vm.py @@ -26,16 +26,15 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.labs.begin_claim_any_vm( + client.labs.begin_claim_any_vm( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ClaimAnyVm.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_ClaimAnyVm.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_create_environment.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_create_environment.py index 3996c9e69571..1718bfadaf63 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_create_environment.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_create_environment.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.labs.begin_create_environment( + client.labs.begin_create_environment( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", lab_virtual_machine_creation_parameter={ "location": "{location}", "name": "{vmName}", @@ -46,7 +46,7 @@ def main(): "version": "Latest", }, "labSubnetName": "{virtualnetwork-subnet-name}", - "labVirtualNetworkId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}", + "labVirtualNetworkId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/myLabName/virtualnetworks/{virtualNetworkName}", "password": "{userPassword}", "size": "Standard_A2_v2", "storageType": "Standard", @@ -55,9 +55,8 @@ def main(): "tags": {"tagName1": "tagValue1"}, }, ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateEnvironment.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_CreateEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_create_or_update.py index ce9cd7437531..ddb05ac51839 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_create_or_update.py @@ -26,21 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.labs.begin_create_or_update( resource_group_name="resourceGroupName", - name="{labName}", - lab={ - "location": "{location}", - "properties": {"labStorageType": "{Standard|Premium}"}, - "tags": {"tagName1": "tagValue1"}, - }, + name="myLabName", + lab={"location": "{location}", "properties": {"labStorageType": "Premium"}, "tags": {"tagName1": "tagValue1"}}, ).result() print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_delete.py index 23ff73017edc..97880afb820d 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_delete.py @@ -26,16 +26,15 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.labs.begin_delete( + client.labs.begin_delete( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_ensure_current_user_profile.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_ensure_current_user_profile.py new file mode 100644 index 000000000000..b1aaf6853c41 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_ensure_current_user_profile.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python labs_ensure_current_user_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.labs.ensure_current_user_profile( + resource_group_name="resourceGroupName", + name="myLabName", + ) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_EnsureCurrentUserProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_export_resource_usage.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_export_resource_usage.py index c11e48ff81ae..f5fe71754451 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_export_resource_usage.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_export_resource_usage.py @@ -26,16 +26,15 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.labs.begin_export_resource_usage( + client.labs.begin_export_resource_usage( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ExportResourceUsage.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_ExportResourceUsage.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_generate_upload_uri.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_generate_upload_uri.py index 55f60c2d98c0..93058dd6ec14 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_generate_upload_uri.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_generate_upload_uri.py @@ -26,16 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.labs.generate_upload_uri( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_GenerateUploadUri.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_GenerateUploadUri.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_get.py index a6b381ed8498..2cb4c07299d8 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_get.py @@ -26,16 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.labs.get( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_import_virtual_machine.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_import_virtual_machine.py index 0d0a353b62b5..a0a4a6fe69c1 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_import_virtual_machine.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_import_virtual_machine.py @@ -26,16 +26,15 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.labs.begin_import_virtual_machine( + client.labs.begin_import_virtual_machine( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ImportVirtualMachine.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_ImportVirtualMachine.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_by_resource_group.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_by_resource_group.py index 9a3c761d4541..c895e3f833da 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_by_resource_group.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_by_resource_group.py @@ -26,7 +26,7 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.labs.list_by_resource_group( @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListByResourceGroup.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_by_subscription.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_by_subscription.py index 9e539c8338fb..270852782d1a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_by_subscription.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_by_subscription.py @@ -26,7 +26,7 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.labs.list_by_subscription() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListBySubscription.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_vhds.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_vhds.py index 1074a444ff8e..b629dc62ec88 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_vhds.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_list_vhds.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.labs.list_vhds( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListVhds.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_ListVhds.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_update.py index c596c2cecd17..c46a95fa6c58 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/labs_update.py @@ -26,16 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.labs.update( resource_group_name="resourceGroupName", - name="{labName}", + name="myLabName", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Labs_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_create_or_update.py index caf8f96a0252..34e60e460dc5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_create_or_update.py @@ -26,26 +26,27 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.notification_channels.create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{notificationChannelName}", notification_channel={ + "location": "{location}", "properties": { "description": "Integration configured for auto-shutdown", "emailRecipient": "{email}", "events": [{"eventName": "AutoShutdown"}], "notificationLocale": "en", "webHookUrl": "{webhookUrl}", - } + }, }, ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/NotificationChannels_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_delete.py index 07fb6bdfe5d0..580aee264322 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.notification_channels.delete( + client.notification_channels.delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{notificationChannelName}", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/NotificationChannels_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_get.py index a506e1468c04..cc66218b9177 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.notification_channels.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{notificationChannelName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/NotificationChannels_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_list.py index 0648ddadc163..da88601e3ba5 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.notification_channels.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/NotificationChannels_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_notify.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_notify.py index 261b3941ba4e..820ac13e3337 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_notify.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_notify.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.notification_channels.notify( + client.notification_channels.notify( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{notificationChannelName}", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Notify.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/NotificationChannels_Notify.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_update.py index fdf5cff66e9d..5a9b8097fd17 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/notification_channels_update.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.notification_channels.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{notificationChannelName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/NotificationChannels_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/operations_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/operations_get.py index 07e70d5b6316..4abb1b5f9e8c 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/operations_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/operations_get.py @@ -26,16 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.operations.get( - location_name="{locationName}", + location_name="locationName", name="{operationName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Operations_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Operations_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_create_or_update.py index 1a95060b1ca0..f131cb67163a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_create_or_update.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.policies.create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", policy_set_name="{policySetName}", name="{policyName}", policy={ @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Policies_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_delete.py index 3da1df2fd5c8..7f3c965e723d 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_delete.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.policies.delete( + client.policies.delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", policy_set_name="{policySetName}", name="{policyName}", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Policies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_get.py index b6cf5ed57a1b..f0dcde73d3bb 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_get.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.policies.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", policy_set_name="{policySetName}", name="{policyName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Policies_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_list.py index 1e4f4d26c0ff..a729bdfb02ee 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_list.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.policies.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", policy_set_name="{policySetName}", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Policies_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_update.py index 97fa7e21d3a8..40cc12ac46be 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policies_update.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.policies.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", policy_set_name="{policySetName}", name="{policyName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Policies_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policy_sets_evaluate_policies.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policy_sets_evaluate_policies.py index d3a599707a82..5d7377a83b4e 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policy_sets_evaluate_policies.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policy_sets_evaluate_policies.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.policy_sets.evaluate_policies( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{policySetName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/PolicySets_EvaluatePolicies.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/PolicySets_EvaluatePolicies.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policy_sets_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policy_sets_list.py new file mode 100644 index 000000000000..fa0b3fe90299 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/policy_sets_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python policy_sets_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.policy_sets.list( + resource_group_name="resourceGroupName", + lab_name="myLabName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/PolicySets_List.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/provider_operations_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/provider_operations_list.py index fb71cb0eb23c..d71cdcf15958 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/provider_operations_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/provider_operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ProviderOperations_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ProviderOperations_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_create_or_update.py index a3ebc2e7a0df..737924d81eba 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_create_or_update.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.schedules.create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{scheduleName}", schedule={ "location": "{location}", @@ -46,7 +46,7 @@ def main(): "webhookUrl": "{webhookUrl}", }, "status": "{Enabled|Disabled}", - "targetResourceId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}", + "targetResourceId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/myLabName", "taskType": "{myLabVmTaskType}", "timeZoneId": "Pacific Standard Time", "weeklyRecurrence": { @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Schedules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_delete.py index 00ebac8f7ba9..17a876dc5c07 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.schedules.delete( + client.schedules.delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{scheduleName}", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Schedules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_execute.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_execute.py index 419268570421..790e97b723fb 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_execute.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_execute.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.schedules.begin_execute( + client.schedules.begin_execute( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{scheduleName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Execute.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Schedules_Execute.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_get.py index db0599fa03fd..310ac0a05e81 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.schedules.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{scheduleName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Schedules_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_list.py index 488a52fe9dce..bc8fe76b6bca 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.schedules.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Schedules_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_list_applicable.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_list_applicable.py index 1920dfb1e7ac..bc7c098ce85a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_list_applicable.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_list_applicable.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.schedules.list_applicable( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{scheduleName}", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_ListApplicable.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Schedules_ListApplicable.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_update.py index b9e6000a8cf4..b9bfec57c042 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/schedules_update.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.schedules.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{scheduleName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Schedules_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_create_or_update.py index f9d4f4c1bf0d..fc9c41955251 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_create_or_update.py @@ -26,19 +26,19 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.secrets.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{secretName}", - secret={"properties": {"value": "{secret}"}}, + secret={"location": "{location}", "properties": {"value": "{secret}"}}, ).result() print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Secrets_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_delete.py index 7586df053724..357f12aeafee 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_delete.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.secrets.delete( + client.secrets.delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{secretName}", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Secrets_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_get.py index eef7db1ceda3..c4b50aac056a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_get.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.secrets.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{secretName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Secrets_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_list.py index 4dcd3064db73..ecbfc52fe2e7 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_list.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.secrets.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Secrets_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_update.py index 1786d22a2da0..45315f65b349 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/secrets_update.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.secrets.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{secretName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Secrets_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_create_or_update.py index 8e04d3d7aa01..8e115aa2405c 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_create_or_update.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabric_schedules.create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", service_fabric_name="{serviceFrabicName}", name="{scheduleName}", @@ -48,7 +48,7 @@ def main(): "webhookUrl": "{webhoolUrl}", }, "status": "{Enabled|Disabled}", - "targetResourceId": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/users/{uniqueIdentifier}/servicefabrics/{serviceFrabicName}", + "targetResourceId": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/myLabName/users/{uniqueIdentifier}/servicefabrics/{serviceFrabicName}", "taskType": "{Unknown|LabVmsShutdownTask|LabVmsStartupTask|LabVmReclamationTask|ComputeVmShutdownTask}", "timeZoneId": "Pacific Standard Time", "weeklyRecurrence": { @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabricSchedules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_delete.py index 37437bfca16d..59f0a875c9be 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_delete.py @@ -26,19 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.service_fabric_schedules.delete( + client.service_fabric_schedules.delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", service_fabric_name="{serviceFrabicName}", name="{scheduleName}", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabricSchedules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_execute.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_execute.py index feb54e9c429b..664ddbd7b75a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_execute.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_execute.py @@ -26,19 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.service_fabric_schedules.begin_execute( + client.service_fabric_schedules.begin_execute( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", service_fabric_name="{serviceFrabicName}", name="{scheduleName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Execute.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabricSchedules_Execute.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_get.py index 020828ac2bf1..eda87b3c50eb 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_get.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabric_schedules.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", service_fabric_name="{serviceFrabicName}", name="{scheduleName}", @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabricSchedules_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_list.py index 2880f5255e2f..c56b13804f3a 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_list.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabric_schedules.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", service_fabric_name="{serviceFrabicName}", ) @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabricSchedules_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_update.py index 7ea8fc1bf546..dbeabcdaa3b0 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabric_schedules_update.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabric_schedules.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="@me", service_fabric_name="{serviceFrabicName}", name="{scheduleName}", @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabricSchedules_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_create_or_update.py index 54def811f813..d09a7d67c68e 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_create_or_update.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabrics.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{serviceFabricName}", service_fabric={ @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabrics_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_delete.py index d8557dddff2a..b1a7e83fa371 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_delete.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.service_fabrics.begin_delete( + client.service_fabrics.begin_delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{serviceFabricName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabrics_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_get.py index 33478a50a719..b9d963a01873 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_get.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabrics.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{serviceFabricName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabrics_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_list.py index 70be57c20082..2e13245556bc 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_list.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabrics.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabrics_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_list_applicable_schedules.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_list_applicable_schedules.py index 89934ab0ea2b..49183be1e964 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_list_applicable_schedules.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_list_applicable_schedules.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabrics.list_applicable_schedules( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{serviceFabricName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_ListApplicableSchedules.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabrics_ListApplicableSchedules.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_start.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_start.py index c3c859b5e9c7..6bd1a1a39791 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_start.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_start.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.service_fabrics.begin_start( + client.service_fabrics.begin_start( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{serviceFabricName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Start.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabrics_Start.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_stop.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_stop.py index a63563ac0709..fe4de64d37aa 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_stop.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_stop.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.service_fabrics.begin_stop( + client.service_fabrics.begin_stop( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{serviceFabricName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Stop.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabrics_Stop.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_update.py index af19351ec3ee..8dea2e3c9aed 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_fabrics_update.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_fabrics.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", user_name="{userName}", name="{serviceFabricName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceFabrics_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_create_or_update.py index 53d80774ed5b..d3328fcedc62 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_create_or_update.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_runners.create_or_update( resource_group_name="resourceGroupName", - lab_name="{devtestlabName}", + lab_name="myLabName", name="{servicerunnerName}", service_runner={ "identity": { @@ -41,12 +41,13 @@ def main(): "type": "{identityType}", }, "location": "{location}", + "properties": {}, "tags": {"tagName1": "tagValue1"}, }, ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceRunners_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_delete.py index 591754c62ade..d53775b7de64 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.service_runners.delete( + client.service_runners.begin_delete( resource_group_name="resourceGroupName", - lab_name="{devtestlabName}", + lab_name="myLabName", name="{servicerunnerName}", - ) - print(response) + ).result() -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceRunners_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_get.py index 788c31a9a768..83463a3ea7f6 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.service_runners.get( resource_group_name="resourceGroupName", - lab_name="{devtestlabName}", + lab_name="myLabName", name="{servicerunnerName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceRunners_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_list.py new file mode 100644 index 000000000000..209e692c604a --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/service_runners_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python service_runners_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.service_runners.list( + resource_group_name="resourceGroupName", + lab_name="myLabName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/ServiceRunners_List.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_create_or_update.py new file mode 100644 index 000000000000..1aacfd0f4081 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_create_or_update.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_galleries_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.shared_galleries.create_or_update( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{sharedGalleryName}", + shared_gallery={ + "location": "{location}", + "properties": { + "allowAllImages": "{Enabled|Disabled}", + "galleryId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.compute/galleries/{sharedGalleryName}", + }, + "tags": {"tagName1": "tagValue1"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedGalleries_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_delete.py new file mode 100644 index 000000000000..f245b28a2ab8 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_galleries_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.shared_galleries.delete( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{sharedGalleryName}", + ) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedGalleries_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_get.py new file mode 100644 index 000000000000..3f045fbf972c --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_galleries_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.shared_galleries.get( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{sharedGalleryName}", + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedGalleries_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_list.py new file mode 100644 index 000000000000..c9ed50d00302 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_galleries_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.shared_galleries.list( + resource_group_name="resourceGroupName", + lab_name="myLabName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedGalleries_List.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_update.py new file mode 100644 index 000000000000..872d64ffe752 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_galleries_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_galleries_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.shared_galleries.update( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{sharedGalleryName}", + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedGalleries_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_create_or_update.py new file mode 100644 index 000000000000..35c1b17531d2 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_create_or_update.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_images_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.shared_images.create_or_update( + resource_group_name="resourceGroupName", + lab_name="myLabName", + shared_gallery_name="{sharedGalleryName}", + name="{name}", + shared_image={ + "location": "{location}", + "properties": { + "definitionName": "{definitionName}", + "displayName": "{displayName}", + "enableState": "{enabledState}", + "imageType": "{imageType}", + "osType": "{osType}", + }, + "tags": {"tagName1": "tagValue1"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedImages_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_delete.py new file mode 100644 index 000000000000..730ed27a5aa9 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_images_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.shared_images.delete( + resource_group_name="resourceGroupName", + lab_name="myLabName", + shared_gallery_name="{sharedGalleryName}", + name="{name}", + ) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedImages_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_get.py new file mode 100644 index 000000000000..408cf617646a --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_images_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.shared_images.get( + resource_group_name="resourceGroupName", + lab_name="myLabName", + shared_gallery_name="{sharedGalleryName}", + name="{name}", + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedImages_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_list.py new file mode 100644 index 000000000000..5cf0967c8644 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_images_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.shared_images.list( + resource_group_name="resourceGroupName", + lab_name="myLabName", + shared_gallery_name="{sharedGalleryName}", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedImages_List.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_update.py new file mode 100644 index 000000000000..faaba9e812b7 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/shared_images_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python shared_images_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.shared_images.update( + resource_group_name="resourceGroupName", + lab_name="myLabName", + shared_gallery_name="{sharedGalleryName}", + name="{name}", + ) + print(response) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/SharedImages_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_create_or_update.py index 8cf033b1d5e2..57951d76dbbe 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_create_or_update.py @@ -26,31 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.users.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{devtestlabName}", + lab_name="myLabName", name="{userName}", - user={ - "location": "{location}", - "properties": { - "identity": { - "appId": "{appId}", - "objectId": "{objectId}", - "principalId": "{principalId}", - "principalName": "{principalName}", - "tenantId": "{tenantId}", - }, - "secretStore": {"keyVaultId": "{keyVaultId}", "keyVaultUri": "{keyVaultUri}"}, - }, - "tags": {"tagName1": "tagValue1"}, - }, ).result() print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Users_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_delete.py index 8ec0493be0fa..8fe77d953874 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.users.begin_delete( + client.users.begin_delete( resource_group_name="resourceGroupName", - lab_name="{devtestlabName}", + lab_name="myLabName", name="{userName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Users_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_get.py index a84c50355976..faafe55494e8 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.users.get( resource_group_name="resourceGroupName", - lab_name="{devtestlabName}", + lab_name="myLabName", name="{userName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Users_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_list.py index 4433f3069ca1..e023f26c50d0 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.users.list( resource_group_name="resourceGroupName", - lab_name="{devtestlabName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Users_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_update.py index 5ca72d9a7841..f67aca123768 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/users_update.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.users.update( resource_group_name="resourceGroupName", - lab_name="{devtestlabName}", + lab_name="myLabName", name="{userName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/Users_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_create_or_update.py index 52126fc43bf0..ae7c3685c9d1 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_create_or_update.py @@ -26,13 +26,13 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machine_schedules.create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", - virtual_machine_name="{vmName}", + lab_name="myLabName", + virtual_machine_name="vmName", name="LabVmsShutdown", schedule={ "location": "{location}", @@ -47,7 +47,7 @@ def main(): "webhookUrl": "{webhookUrl}", }, "status": "Enabled", - "targetResourceId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualMachines/{vmName}", + "targetResourceId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/myLabName/virtualMachines/{vmName}", "taskType": "LabVmsShutdownTask", "timeZoneId": "Pacific Standard Time", "weeklyRecurrence": {"time": "1700", "weekdays": ["Friday", "Saturday", "Sunday"]}, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachineSchedules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_delete.py index f0eb158ef93a..3a18102607a8 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_delete.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machine_schedules.delete( + client.virtual_machine_schedules.delete( resource_group_name="resourceGroupName", - lab_name="{labName}", - virtual_machine_name="{vmName}", + lab_name="myLabName", + virtual_machine_name="vmName", name="LabVmsShutdown", ) - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachineSchedules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_execute.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_execute.py index 12cb06d6fdf3..465d17f8120e 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_execute.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_execute.py @@ -26,18 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machine_schedules.begin_execute( + client.virtual_machine_schedules.begin_execute( resource_group_name="resourceGroupName", - lab_name="{labName}", - virtual_machine_name="{vmName}", + lab_name="myLabName", + virtual_machine_name="vmName", name="LabVmsShutdown", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Execute.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachineSchedules_Execute.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_get.py index 5f6a66e34393..cdd366050d27 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_get.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machine_schedules.get( resource_group_name="resourceGroupName", - lab_name="{labName}", - virtual_machine_name="{vmName}", + lab_name="myLabName", + virtual_machine_name="vmName", name="LabVmsShutdown", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachineSchedules_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_list.py index 1acd0ff9ba76..211b9c4f0171 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_list.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machine_schedules.list( resource_group_name="resourceGroupName", - lab_name="{labName}", - virtual_machine_name="{vmName}", + lab_name="myLabName", + virtual_machine_name="vmName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachineSchedules_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_update.py index d7584add1fec..814fdac6b203 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machine_schedules_update.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machine_schedules.update( resource_group_name="resourceGroupName", - lab_name="{labName}", - virtual_machine_name="{vmName}", + lab_name="myLabName", + virtual_machine_name="vmName", name="LabVmsShutdown", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachineSchedules_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_add_data_disk.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_add_data_disk.py index aefdfdfe3dcc..f85030c5fa70 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_add_data_disk.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_add_data_disk.py @@ -26,20 +26,19 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_add_data_disk( + client.virtual_machines.begin_add_data_disk( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{virtualMachineName}", data_disk_properties={ "attachNewDataDiskOptions": {"diskName": "{diskName}", "diskSizeGiB": 127, "diskType": "{diskType}"} }, ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_AddDataDisk.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_AddDataDisk.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_apply_artifacts.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_apply_artifacts.py index 9c53ef217113..f0fda600a71b 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_apply_artifacts.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_apply_artifacts.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_apply_artifacts( + client.virtual_machines.begin_apply_artifacts( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ApplyArtifacts.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_ApplyArtifacts.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_claim.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_claim.py index 493beae4a7fb..fec06515c351 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_claim.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_claim.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_claim( + client.virtual_machines.begin_claim( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Claim.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Claim.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_clear_artifact_results.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_clear_artifact_results.py new file mode 100644 index 000000000000..f9814e85aab4 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_clear_artifact_results.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.devtestlabs import DevTestLabsClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-devtestlabs +# USAGE + python virtual_machines_clear_artifact_results.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DevTestLabsClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.virtual_machines.clear_artifact_results( + resource_group_name="resourceGroupName", + lab_name="myLabName", + name="{vmNname}", + ) + + +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_ClearArtifactResults.json +if __name__ == "__main__": + main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_create_or_update.py index 8998af79465b..0d5632cb2af8 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_create_or_update.py @@ -26,12 +26,12 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machines.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", lab_virtual_machine={ "location": "{location}", @@ -42,11 +42,11 @@ def main(): "offer": "UbuntuServer", "osType": "Linux", "publisher": "Canonical", - "sku": "16.04-LTS", + "sku": "18.04-LTS", "version": "Latest", }, "labSubnetName": "{virtualNetworkName}Subnet", - "labVirtualNetworkId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}", + "labVirtualNetworkId": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/myLabName/virtualnetworks/{virtualNetworkName}", "password": "{userPassword}", "size": "Standard_A2_v2", "storageType": "Standard", @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_delete.py index 94ad965b8643..4cbf60a21d3f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_delete( + client.virtual_machines.begin_delete( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_detach_data_disk.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_detach_data_disk.py index 6c68d9ce9984..db5bb91e98e7 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_detach_data_disk.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_detach_data_disk.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_detach_data_disk( + client.virtual_machines.begin_detach_data_disk( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{virtualMachineName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_DetachDataDisk.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_DetachDataDisk.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_get.py index 0bd113716f40..0b07db4ba67c 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machines.get( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_get_rdp_file_contents.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_get_rdp_file_contents.py index 4b0442bb327e..6d70d74ab73f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_get_rdp_file_contents.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_get_rdp_file_contents.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machines.get_rdp_file_contents( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_GetRdpFileContents.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_GetRdpFileContents.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_list.py index 426e7971fcfa..b3c69af59be2 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machines.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_list_applicable_schedules.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_list_applicable_schedules.py index dee44204621f..2b70e850e8b1 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_list_applicable_schedules.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_list_applicable_schedules.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machines.list_applicable_schedules( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ListApplicableSchedules.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_ListApplicableSchedules.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_redeploy.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_redeploy.py index faf420e67364..ef60864129f6 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_redeploy.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_redeploy.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_redeploy( + client.virtual_machines.begin_redeploy( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Redeploy.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Redeploy.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_resize.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_resize.py index f2cf92b543a2..dd90e92bfe9b 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_resize.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_resize.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_resize( + client.virtual_machines.begin_resize( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Resize.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Resize.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_restart.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_restart.py index fb876e0aa206..f265d177e377 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_restart.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_restart.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_restart( + client.virtual_machines.begin_restart( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Restart.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Restart.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_start.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_start.py index 6993bd442704..14bbd0986e3f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_start.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_start.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_start( + client.virtual_machines.begin_start( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Start.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Start.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_stop.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_stop.py index a0b4a9e74312..85b9254bd3cd 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_stop.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_stop.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_stop( + client.virtual_machines.begin_stop( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Stop.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Stop.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_transfer_disks.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_transfer_disks.py index 3213670c8d9d..d7951a7a8e41 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_transfer_disks.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_transfer_disks.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_transfer_disks( + client.virtual_machines.begin_transfer_disks( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{virtualmachineName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_TransferDisks.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_TransferDisks.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_un_claim.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_un_claim.py index 864992391a45..11c456c86317 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_un_claim.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_un_claim.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_machines.begin_un_claim( + client.virtual_machines.begin_un_claim( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_UnClaim.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_UnClaim.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_update.py index 23b54273caab..cdb814a3193c 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_machines_update.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_machines.update( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", name="{vmName}", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualMachines_Update.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_create_or_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_create_or_update.py index dcb9c77f75c7..653a068eb79f 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_create_or_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_create_or_update.py @@ -26,18 +26,18 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_networks.begin_create_or_update( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="{virtualNetworkName}", - virtual_network={"location": "{location}", "tags": {"tagName1": "tagValue1"}}, + lab_name="myLabName", + name="labVirtualNetwork", + virtual_network={"properties": {}}, ).result() print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_CreateOrUpdate.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualNetworks_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_delete.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_delete.py index 8aefd1303feb..7f55a709b15d 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_delete.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_delete.py @@ -26,17 +26,16 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.virtual_networks.begin_delete( + client.virtual_networks.begin_delete( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="{virtualNetworkName}", + lab_name="myLabName", + name="labVirtualNetwork", ).result() - print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Delete.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualNetworks_Delete.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_get.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_get.py index 9145edb82d6b..be80d0bc491d 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_get.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_get.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_networks.get( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="{virtualNetworkName}", + lab_name="myLabName", + name="labVirtualNetwork", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualNetworks_Get.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_list.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_list.py index 28b50d51455a..227e545e3be3 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_list.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_list.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_networks.list( resource_group_name="resourceGroupName", - lab_name="{labName}", + lab_name="myLabName", ) for item in response: print(item) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_List.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualNetworks_List.json if __name__ == "__main__": main() diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_update.py b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_update.py index 446844300efd..2c68c57c4b68 100644 --- a/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_update.py +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/generated_samples/virtual_networks_update.py @@ -26,17 +26,17 @@ def main(): client = DevTestLabsClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.virtual_networks.update( resource_group_name="resourceGroupName", - lab_name="{labName}", - name="{virtualNetworkName}", + lab_name="myLabName", + name="labVirtualNetwork", ) print(response) -# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Update.json +# x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2021-09-01/examples/VirtualNetworks_Update.json if __name__ == "__main__": main()