diff --git a/sdk/labservices/azure-mgmt-labservices/_meta.json b/sdk/labservices/azure-mgmt-labservices/_meta.json index f073a3aeb38a..b4a9658d8ff4 100644 --- a/sdk/labservices/azure-mgmt-labservices/_meta.json +++ b/sdk/labservices/azure-mgmt-labservices/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.0.6369", - "use": "@autorest/python@5.6.2", - "commit": "90167a86aca9eed5d51c299b262212738e233e2a", + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "a99d393c26684bbb9b4d66531ed1eb9ba9d11e23", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/labservices/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.2 --version=3.0.6369", + "autorest_command": "autorest specification/labservices/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "readme": "specification/labservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/__init__.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/__init__.py index 254c16b251dd..cb4be8d77867 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/__init__.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/__init__.py @@ -6,11 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._managed_labs_client import ManagedLabsClient +from ._lab_services_client import LabServicesClient from ._version import VERSION __version__ = VERSION -__all__ = ['ManagedLabsClient'] +__all__ = ['LabServicesClient'] try: from ._patch import patch_sdk # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_configuration.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_configuration.py index 4e55c44cfa8b..5030f14bbc94 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_configuration.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_configuration.py @@ -21,15 +21,15 @@ from azure.core.credentials import TokenCredential -class ManagedLabsClientConfiguration(Configuration): - """Configuration for ManagedLabsClient. +class LabServicesClientConfiguration(Configuration): + """Configuration for LabServicesClient. Note that all parameters used to create this instance are saved as instance attributes. :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -44,11 +44,11 @@ def __init__( raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ManagedLabsClientConfiguration, self).__init__(**kwargs) + super(LabServicesClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-10-15" + self.api_version = "2021-10-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-labservices/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_managed_labs_client.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_lab_services_client.py similarity index 55% rename from sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_managed_labs_client.py rename to sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_lab_services_client.py index b132f533cb7a..e2863e2e4424 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_managed_labs_client.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_lab_services_client.py @@ -16,44 +16,42 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse -from ._configuration import ManagedLabsClientConfiguration -from .operations import ProviderOperationsOperations -from .operations import GlobalUsersOperations -from .operations import LabAccountsOperations +from ._configuration import LabServicesClientConfiguration from .operations import Operations -from .operations import GalleryImagesOperations +from .operations import OperationResultsOperations +from .operations import LabPlansOperations +from .operations import ImagesOperations from .operations import LabsOperations -from .operations import EnvironmentSettingsOperations -from .operations import EnvironmentsOperations from .operations import UsersOperations +from .operations import VirtualMachinesOperations +from .operations import SchedulesOperations from . import models -class ManagedLabsClient(object): - """The Managed Labs Client. +class LabServicesClient(object): + """Azure Lab Services REST API. - :ivar provider_operations: ProviderOperationsOperations operations - :vartype provider_operations: azure.mgmt.labservices.operations.ProviderOperationsOperations - :ivar global_users: GlobalUsersOperations operations - :vartype global_users: azure.mgmt.labservices.operations.GlobalUsersOperations - :ivar lab_accounts: LabAccountsOperations operations - :vartype lab_accounts: azure.mgmt.labservices.operations.LabAccountsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.labservices.operations.Operations - :ivar gallery_images: GalleryImagesOperations operations - :vartype gallery_images: azure.mgmt.labservices.operations.GalleryImagesOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: azure.mgmt.labservices.operations.OperationResultsOperations + :ivar lab_plans: LabPlansOperations operations + :vartype lab_plans: azure.mgmt.labservices.operations.LabPlansOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.labservices.operations.ImagesOperations :ivar labs: LabsOperations operations :vartype labs: azure.mgmt.labservices.operations.LabsOperations - :ivar environment_settings: EnvironmentSettingsOperations operations - :vartype environment_settings: azure.mgmt.labservices.operations.EnvironmentSettingsOperations - :ivar environments: EnvironmentsOperations operations - :vartype environments: azure.mgmt.labservices.operations.EnvironmentsOperations :ivar users: UsersOperations operations :vartype users: azure.mgmt.labservices.operations.UsersOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.labservices.operations.VirtualMachinesOperations + :ivar schedules: SchedulesOperations operations + :vartype schedules: azure.mgmt.labservices.operations.SchedulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -69,7 +67,7 @@ def __init__( # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' - self._config = ManagedLabsClientConfiguration(credential, subscription_id, **kwargs) + self._config = LabServicesClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -77,31 +75,47 @@ def __init__( self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - self.provider_operations = ProviderOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.global_users = GlobalUsersOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) - self.lab_accounts = LabAccountsOperations( + self.operation_results = OperationResultsOperations( self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( + self.lab_plans = LabPlansOperations( self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( + self.images = ImagesOperations( self._client, self._config, self._serialize, self._deserialize) self.labs = LabsOperations( self._client, self._config, self._serialize, self._deserialize) - self.environment_settings = EnvironmentSettingsOperations( + self.users = UsersOperations( self._client, self._config, self._serialize, self._deserialize) - self.environments = EnvironmentsOperations( + self.virtual_machines = VirtualMachinesOperations( self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( + self.schedules = SchedulesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() def __enter__(self): - # type: () -> ManagedLabsClient + # type: () -> LabServicesClient self._client.__enter__() return self diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_metadata.json b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_metadata.json index 0486756d139e..bc61d5fc2829 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_metadata.json +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2018-10-15", - "total_api_version_list": ["2018-10-15"], + "chosen_version": "2021-10-01-preview", + "total_api_version_list": ["2021-10-01-preview"], "client": { - "name": "ManagedLabsClient", - "filename": "_managed_labs_client", - "description": "The Managed Labs Client.", + "name": "LabServicesClient", + "filename": "_lab_services_client", + "description": "Azure Lab Services REST API.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ManagedLabsClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ManagedLabsClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"LabServicesClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"LabServicesClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -23,7 +23,7 @@ }, "subscription_id": { "signature": "subscription_id, # type: str", - "description": "The subscription ID.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -37,7 +37,7 @@ }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The subscription ID.", + "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } @@ -98,20 +98,13 @@ "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "provider_operations": "ProviderOperationsOperations", - "global_users": "GlobalUsersOperations", - "lab_accounts": "LabAccountsOperations", "operations": "Operations", - "gallery_images": "GalleryImagesOperations", + "operation_results": "OperationResultsOperations", + "lab_plans": "LabPlansOperations", + "images": "ImagesOperations", "labs": "LabsOperations", - "environment_settings": "EnvironmentSettingsOperations", - "environments": "EnvironmentsOperations", - "users": "UsersOperations" - }, - "operation_mixins": { - "sync_imports": "None", - "async_imports": "None", - "operations": { - } + "users": "UsersOperations", + "virtual_machines": "VirtualMachinesOperations", + "schedules": "SchedulesOperations" } } \ No newline at end of file diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_version.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_version.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/__init__.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/__init__.py index 0058746dccb3..5dcf1000658c 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/__init__.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._managed_labs_client import ManagedLabsClient -__all__ = ['ManagedLabsClient'] +from ._lab_services_client import LabServicesClient +__all__ = ['LabServicesClient'] diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_configuration.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_configuration.py index ea297364f7eb..3b09a2a2ae1a 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_configuration.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_configuration.py @@ -19,15 +19,15 @@ from azure.core.credentials_async import AsyncTokenCredential -class ManagedLabsClientConfiguration(Configuration): - """Configuration for ManagedLabsClient. +class LabServicesClientConfiguration(Configuration): + """Configuration for LabServicesClient. Note that all parameters used to create this instance are saved as instance attributes. :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -41,11 +41,11 @@ def __init__( raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ManagedLabsClientConfiguration, self).__init__(**kwargs) + super(LabServicesClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-10-15" + self.api_version = "2021-10-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-labservices/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_managed_labs_client.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_lab_services_client.py similarity index 54% rename from sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_managed_labs_client.py rename to sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_lab_services_client.py index 51ce40608437..a0f3fb9ed927 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_managed_labs_client.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/_lab_services_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -15,43 +16,40 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ManagedLabsClientConfiguration -from .operations import ProviderOperationsOperations -from .operations import GlobalUsersOperations -from .operations import LabAccountsOperations +from ._configuration import LabServicesClientConfiguration from .operations import Operations -from .operations import GalleryImagesOperations +from .operations import OperationResultsOperations +from .operations import LabPlansOperations +from .operations import ImagesOperations from .operations import LabsOperations -from .operations import EnvironmentSettingsOperations -from .operations import EnvironmentsOperations from .operations import UsersOperations +from .operations import VirtualMachinesOperations +from .operations import SchedulesOperations from .. import models -class ManagedLabsClient(object): - """The Managed Labs Client. +class LabServicesClient(object): + """Azure Lab Services REST API. - :ivar provider_operations: ProviderOperationsOperations operations - :vartype provider_operations: azure.mgmt.labservices.aio.operations.ProviderOperationsOperations - :ivar global_users: GlobalUsersOperations operations - :vartype global_users: azure.mgmt.labservices.aio.operations.GlobalUsersOperations - :ivar lab_accounts: LabAccountsOperations operations - :vartype lab_accounts: azure.mgmt.labservices.aio.operations.LabAccountsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.labservices.aio.operations.Operations - :ivar gallery_images: GalleryImagesOperations operations - :vartype gallery_images: azure.mgmt.labservices.aio.operations.GalleryImagesOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: azure.mgmt.labservices.aio.operations.OperationResultsOperations + :ivar lab_plans: LabPlansOperations operations + :vartype lab_plans: azure.mgmt.labservices.aio.operations.LabPlansOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.labservices.aio.operations.ImagesOperations :ivar labs: LabsOperations operations :vartype labs: azure.mgmt.labservices.aio.operations.LabsOperations - :ivar environment_settings: EnvironmentSettingsOperations operations - :vartype environment_settings: azure.mgmt.labservices.aio.operations.EnvironmentSettingsOperations - :ivar environments: EnvironmentsOperations operations - :vartype environments: azure.mgmt.labservices.aio.operations.EnvironmentsOperations :ivar users: UsersOperations operations :vartype users: azure.mgmt.labservices.aio.operations.UsersOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.labservices.aio.operations.VirtualMachinesOperations + :ivar schedules: SchedulesOperations operations + :vartype schedules: azure.mgmt.labservices.aio.operations.SchedulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription ID. + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -66,7 +64,7 @@ def __init__( ) -> None: if not base_url: base_url = 'https://management.azure.com' - self._config = ManagedLabsClientConfiguration(credential, subscription_id, **kwargs) + self._config = LabServicesClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -74,29 +72,44 @@ def __init__( self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - self.provider_operations = ProviderOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.global_users = GlobalUsersOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) - self.lab_accounts = LabAccountsOperations( + self.operation_results = OperationResultsOperations( self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( + self.lab_plans = LabPlansOperations( self._client, self._config, self._serialize, self._deserialize) - self.gallery_images = GalleryImagesOperations( + self.images = ImagesOperations( self._client, self._config, self._serialize, self._deserialize) self.labs = LabsOperations( self._client, self._config, self._serialize, self._deserialize) - self.environment_settings = EnvironmentSettingsOperations( + self.users = UsersOperations( self._client, self._config, self._serialize, self._deserialize) - self.environments = EnvironmentsOperations( + self.virtual_machines = VirtualMachinesOperations( self._client, self._config, self._serialize, self._deserialize) - self.users = UsersOperations( + self.schedules = SchedulesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "ManagedLabsClient": + async def __aenter__(self) -> "LabServicesClient": await self._client.__aenter__() return self diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/__init__.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/__init__.py index bfdfe669911b..1ae701f1d369 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/__init__.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/__init__.py @@ -6,24 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._provider_operations_operations import ProviderOperationsOperations -from ._global_users_operations import GlobalUsersOperations -from ._lab_accounts_operations import LabAccountsOperations from ._operations import Operations -from ._gallery_images_operations import GalleryImagesOperations +from ._operation_results_operations import OperationResultsOperations +from ._lab_plans_operations import LabPlansOperations +from ._images_operations import ImagesOperations from ._labs_operations import LabsOperations -from ._environment_settings_operations import EnvironmentSettingsOperations -from ._environments_operations import EnvironmentsOperations from ._users_operations import UsersOperations +from ._virtual_machines_operations import VirtualMachinesOperations +from ._schedules_operations import SchedulesOperations __all__ = [ - 'ProviderOperationsOperations', - 'GlobalUsersOperations', - 'LabAccountsOperations', 'Operations', - 'GalleryImagesOperations', + 'OperationResultsOperations', + 'LabPlansOperations', + 'ImagesOperations', 'LabsOperations', - 'EnvironmentSettingsOperations', - 'EnvironmentsOperations', 'UsersOperations', + 'VirtualMachinesOperations', + 'SchedulesOperations', ] diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_environments_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_environments_operations.py deleted file mode 100644 index a2592f642b74..000000000000 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_environments_operations.py +++ /dev/null @@ -1,976 +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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class EnvironmentsOperations: - """EnvironmentsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.labservices.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - expand: Optional[str] = None, - filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.ResponseWithContinuationEnvironment"]: - """List environments in a given environment setting. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param expand: Specify the $expand query. Example: 'properties($expand=networkInterface)'. - :type expand: str - :param filter: The filter to apply to the operation. - :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationEnvironment or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationEnvironment] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationEnvironment"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationEnvironment', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments'} # type: ignore - - async def get( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - expand: Optional[str] = None, - **kwargs - ) -> "_models.Environment": - """Get environment. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :param expand: Specify the $expand query. Example: 'properties($expand=networkInterface)'. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Environment, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.Environment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Environment"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Environment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - async def create_or_update( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - environment: "_models.Environment", - **kwargs - ) -> "_models.Environment": - """Create or replace an existing Environment. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :param environment: Represents an environment instance. - :type environment: ~azure.mgmt.labservices.models.Environment - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Environment, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.Environment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Environment"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment, 'Environment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Environment', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Environment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [202, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Delete environment. This operation can take a while to complete. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - lab_account_name=lab_account_name, - lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_name=environment_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - async def update( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - environment: "_models.EnvironmentFragment", - **kwargs - ) -> "_models.Environment": - """Modify properties of environments. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :param environment: Represents an environment instance. - :type environment: ~azure.mgmt.labservices.models.EnvironmentFragment - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Environment, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.Environment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Environment"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment, 'EnvironmentFragment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Environment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - async def claim( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - **kwargs - ) -> None: - """Claims the environment and assigns it to the user. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.claim.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - claim.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/claim'} # type: ignore - - async def _reset_password_initial( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - reset_password_payload: "_models.ResetPasswordPayload", - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reset_password_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(reset_password_payload, 'ResetPasswordPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _reset_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/resetPassword'} # type: ignore - - async def begin_reset_password( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - reset_password_payload: "_models.ResetPasswordPayload", - **kwargs - ) -> AsyncLROPoller[None]: - """Resets the user password on an environment This operation can take a while to complete. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :param reset_password_payload: Represents the payload for resetting passwords. - :type reset_password_payload: ~azure.mgmt.labservices.models.ResetPasswordPayload - :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._reset_password_initial( - resource_group_name=resource_group_name, - lab_account_name=lab_account_name, - lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_name=environment_name, - reset_password_payload=reset_password_payload, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/resetPassword'} # type: ignore - - async def _start_initial( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/start'} # type: ignore - - async def begin_start( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Starts an environment by starting all resources inside the environment. This operation can take - a while to complete. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - lab_account_name=lab_account_name, - lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_name=environment_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/start'} # type: ignore - - async def _stop_initial( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/stop'} # type: ignore - - async def begin_stop( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Stops an environment by stopping all resources inside the environment This operation can take a - while to complete. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - lab_account_name=lab_account_name, - lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_name=environment_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/stop'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_global_users_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_global_users_operations.py deleted file mode 100644 index 83cc78202237..000000000000 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_global_users_operations.py +++ /dev/null @@ -1,797 +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 typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class GlobalUsersOperations: - """GlobalUsersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.labservices.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get_environment( - self, - user_name: str, - environment_operations_payload: "_models.EnvironmentOperationsPayload", - expand: Optional[str] = None, - **kwargs - ) -> "_models.GetEnvironmentResponse": - """Gets the virtual machine details. - - :param user_name: The name of the user. - :type user_name: str - :param environment_operations_payload: Represents payload for any Environment operations like - get, start, stop, connect. - :type environment_operations_payload: ~azure.mgmt.labservices.models.EnvironmentOperationsPayload - :param expand: Specify the $expand query. Example: 'properties($expand=environment)'. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GetEnvironmentResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.GetEnvironmentResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GetEnvironmentResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_operations_payload, 'EnvironmentOperationsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GetEnvironmentResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_environment.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/getEnvironment'} # type: ignore - - async def get_operation_batch_status( - self, - user_name: str, - operation_batch_status_payload: "_models.OperationBatchStatusPayload", - **kwargs - ) -> "_models.OperationBatchStatusResponse": - """Get batch operation status. - - :param user_name: The name of the user. - :type user_name: str - :param operation_batch_status_payload: Payload to get the status of an operation. - :type operation_batch_status_payload: ~azure.mgmt.labservices.models.OperationBatchStatusPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationBatchStatusResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.OperationBatchStatusResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationBatchStatusResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_operation_batch_status.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(operation_batch_status_payload, 'OperationBatchStatusPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('OperationBatchStatusResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_operation_batch_status.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/getOperationBatchStatus'} # type: ignore - - async def get_operation_status( - self, - user_name: str, - operation_status_payload: "_models.OperationStatusPayload", - **kwargs - ) -> "_models.OperationStatusResponse": - """Gets the status of long running operation. - - :param user_name: The name of the user. - :type user_name: str - :param operation_status_payload: Payload to get the status of an operation. - :type operation_status_payload: ~azure.mgmt.labservices.models.OperationStatusPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatusResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.OperationStatusResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(operation_status_payload, 'OperationStatusPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_operation_status.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/getOperationStatus'} # type: ignore - - async def get_personal_preferences( - self, - user_name: str, - personal_preferences_operations_payload: "_models.PersonalPreferencesOperationsPayload", - **kwargs - ) -> "_models.GetPersonalPreferencesResponse": - """Get personal preferences for a user. - - :param user_name: The name of the user. - :type user_name: str - :param personal_preferences_operations_payload: Represents payload for any Environment - operations like get, start, stop, connect. - :type personal_preferences_operations_payload: ~azure.mgmt.labservices.models.PersonalPreferencesOperationsPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GetPersonalPreferencesResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.GetPersonalPreferencesResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GetPersonalPreferencesResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_personal_preferences.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(personal_preferences_operations_payload, 'PersonalPreferencesOperationsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GetPersonalPreferencesResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_personal_preferences.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/getPersonalPreferences'} # type: ignore - - async def list_environments( - self, - user_name: str, - list_environments_payload: "_models.ListEnvironmentsPayload", - **kwargs - ) -> "_models.ListEnvironmentsResponse": - """List Environments for the user. - - :param user_name: The name of the user. - :type user_name: str - :param list_environments_payload: Represents the payload to list environments owned by a user. - :type list_environments_payload: ~azure.mgmt.labservices.models.ListEnvironmentsPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListEnvironmentsResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.ListEnvironmentsResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListEnvironmentsResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_environments.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(list_environments_payload, 'ListEnvironmentsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ListEnvironmentsResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_environments.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/listEnvironments'} # type: ignore - - async def list_labs( - self, - user_name: str, - **kwargs - ) -> "_models.ListLabsResponse": - """List labs for the user. - - :param user_name: The name of the user. - :type user_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListLabsResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.ListLabsResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListLabsResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.list_labs.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ListLabsResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_labs.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/listLabs'} # type: ignore - - async def register( - self, - user_name: str, - register_payload: "_models.RegisterPayload", - **kwargs - ) -> None: - """Register a user to a managed lab. - - :param user_name: The name of the user. - :type user_name: str - :param register_payload: Represents payload for Register action. - :type register_payload: ~azure.mgmt.labservices.models.RegisterPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.register.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(register_payload, 'RegisterPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - register.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/register'} # type: ignore - - async def _reset_password_initial( - self, - user_name: str, - reset_password_payload: "_models.ResetPasswordPayload", - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reset_password_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(reset_password_payload, 'ResetPasswordPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _reset_password_initial.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/resetPassword'} # type: ignore - - async def begin_reset_password( - self, - user_name: str, - reset_password_payload: "_models.ResetPasswordPayload", - **kwargs - ) -> AsyncLROPoller[None]: - """Resets the user password on an environment This operation can take a while to complete. - - :param user_name: The name of the user. - :type user_name: str - :param reset_password_payload: Represents the payload for resetting passwords. - :type reset_password_payload: ~azure.mgmt.labservices.models.ResetPasswordPayload - :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._reset_password_initial( - user_name=user_name, - reset_password_payload=reset_password_payload, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_password.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/resetPassword'} # type: ignore - - async def _start_environment_initial( - self, - user_name: str, - environment_operations_payload: "_models.EnvironmentOperationsPayload", - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._start_environment_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_operations_payload, 'EnvironmentOperationsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _start_environment_initial.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/startEnvironment'} # type: ignore - - async def begin_start_environment( - self, - user_name: str, - environment_operations_payload: "_models.EnvironmentOperationsPayload", - **kwargs - ) -> AsyncLROPoller[None]: - """Starts an environment by starting all resources inside the environment. This operation can take - a while to complete. - - :param user_name: The name of the user. - :type user_name: str - :param environment_operations_payload: Represents payload for any Environment operations like - get, start, stop, connect. - :type environment_operations_payload: ~azure.mgmt.labservices.models.EnvironmentOperationsPayload - :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._start_environment_initial( - user_name=user_name, - environment_operations_payload=environment_operations_payload, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_environment.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/startEnvironment'} # type: ignore - - async def _stop_environment_initial( - self, - user_name: str, - environment_operations_payload: "_models.EnvironmentOperationsPayload", - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._stop_environment_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_operations_payload, 'EnvironmentOperationsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _stop_environment_initial.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/stopEnvironment'} # type: ignore - - async def begin_stop_environment( - self, - user_name: str, - environment_operations_payload: "_models.EnvironmentOperationsPayload", - **kwargs - ) -> AsyncLROPoller[None]: - """Stops an environment by stopping all resources inside the environment This operation can take a - while to complete. - - :param user_name: The name of the user. - :type user_name: str - :param environment_operations_payload: Represents payload for any Environment operations like - get, start, stop, connect. - :type environment_operations_payload: ~azure.mgmt.labservices.models.EnvironmentOperationsPayload - :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._stop_environment_initial( - user_name=user_name, - environment_operations_payload=environment_operations_payload, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop_environment.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/stopEnvironment'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_gallery_images_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_images_operations.py similarity index 54% rename from sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_gallery_images_operations.py rename to sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_images_operations.py index e46fe31d8e67..0290575973a9 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_gallery_images_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_images_operations.py @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class GalleryImagesOperations: - """GalleryImagesOperations async operations. +class ImagesOperations: + """ImagesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -41,41 +41,35 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - def list( + def list_by_lab_plan( self, resource_group_name: str, - lab_account_name: str, - expand: Optional[str] = None, + lab_plan_name: str, filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.ResponseWithContinuationGalleryImage"]: - """List gallery images in a given lab account. + **kwargs: Any + ) -> AsyncIterable["_models.PagedImages"]: + """Gets all images. - :param resource_group_name: The name of the resource group. + Gets all images from galleries attached to a lab plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param expand: Specify the $expand query. Example: 'properties($select=author)'. - :type expand: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationGalleryImage or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationGalleryImage] + :return: An iterator like instance of either PagedImages or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.PagedImages] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationGalleryImage"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedImages"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -85,24 +79,18 @@ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] # type: ignore + url = self.list_by_lab_plan.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -112,7 +100,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationGalleryImage', pipeline_response) + deserialized = self._deserialize('PagedImages', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -125,61 +113,60 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages'} # type: ignore + list_by_lab_plan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images'} # type: ignore async def get( self, resource_group_name: str, - lab_account_name: str, - gallery_image_name: str, - expand: Optional[str] = None, - **kwargs - ) -> "_models.GalleryImage": - """Get gallery image. - - :param resource_group_name: The name of the resource group. + lab_plan_name: str, + image_name: str, + **kwargs: Any + ) -> "_models.Image": + """Gets an image. + + Gets an image resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param gallery_image_name: The name of the gallery Image. - :type gallery_image_name: str - :param expand: Specify the $expand query. Example: 'properties($select=author)'. - :type expand: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param image_name: The image name. + :type image_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.labservices.models.GalleryImage + :return: Image, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.Image :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + 'imageName': self._serialize.url("image_name", image_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -192,55 +179,59 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('GalleryImage', pipeline_response) + deserialized = self._deserialize('Image', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}'} # type: ignore async def create_or_update( self, resource_group_name: str, - lab_account_name: str, - gallery_image_name: str, - gallery_image: "_models.GalleryImage", - **kwargs - ) -> "_models.GalleryImage": - """Create or replace an existing Gallery Image. - - :param resource_group_name: The name of the resource group. + lab_plan_name: str, + image_name: str, + body: "_models.Image", + **kwargs: Any + ) -> "_models.Image": + """Updates an image via PUT. + + Updates an image resource via PUT. Creating new resources via PUT will not function. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param gallery_image_name: The name of the gallery Image. - :type gallery_image_name: str - :param gallery_image: Represents an image from the Azure Marketplace. - :type gallery_image: ~azure.mgmt.labservices.models.GalleryImage + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param image_name: The image name. + :type image_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.Image :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.labservices.models.GalleryImage + :return: Image, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.Image :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + 'imageName': self._serialize.url("image_name", image_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -254,126 +245,67 @@ async def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') + body_content = self._serialize.body(body, 'Image') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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 response.status_code == 200: - deserialized = self._deserialize('GalleryImage', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 201: - deserialized = self._deserialize('GalleryImage', pipeline_response) + deserialized = self._deserialize('Image', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}'} # type: ignore - async def delete( + async def update( self, resource_group_name: str, - lab_account_name: str, - gallery_image_name: str, - **kwargs - ) -> None: - """Delete gallery image. + lab_plan_name: str, + image_name: str, + body: "_models.ImageUpdate", + **kwargs: Any + ) -> "_models.Image": + """Updates an image. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param gallery_image_name: The name of the gallery Image. - :type gallery_image_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" + Updates an image resource. - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'} # type: ignore - - async def update( - self, - resource_group_name: str, - lab_account_name: str, - gallery_image_name: str, - gallery_image: "_models.GalleryImageFragment", - **kwargs - ) -> "_models.GalleryImage": - """Modify properties of gallery images. - - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param gallery_image_name: The name of the gallery Image. - :type gallery_image_name: str - :param gallery_image: Represents an image from the Azure Marketplace. - :type gallery_image: ~azure.mgmt.labservices.models.GalleryImageFragment + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param image_name: The image name. + :type image_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.ImageUpdate :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.labservices.models.GalleryImage + :return: Image, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.Image :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + 'imageName': self._serialize.url("image_name", image_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -387,7 +319,7 @@ async def update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageFragment') + body_content = self._serialize.body(body, 'ImageUpdate') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -395,12 +327,13 @@ async def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('GalleryImage', pipeline_response) + deserialized = self._deserialize('Image', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_lab_accounts_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_lab_plans_operations.py similarity index 50% rename from sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_lab_accounts_operations.py rename to sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_lab_plans_operations.py index 6963eefada26..8e48cb93adc9 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_lab_accounts_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_lab_plans_operations.py @@ -21,8 +21,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class LabAccountsOperations: - """LabAccountsOperations async operations. +class LabPlansOperations: + """LabPlansOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -45,33 +45,26 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_subscription( self, - expand: Optional[str] = None, filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.ResponseWithContinuationLabAccount"]: - """List lab accounts in a subscription. - - :param expand: Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'. - :type expand: str + **kwargs: Any + ) -> AsyncIterable["_models.PagedLabPlans"]: + """Get all lab plans for a subscription. + + Returns a list of all lab plans within a subscription. + :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationLabAccount or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationLabAccount] + :return: An iterator like instance of either PagedLabPlans or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.PagedLabPlans] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationLabAccount"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedLabPlans"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -83,20 +76,14 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -106,7 +93,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationLabAccount', pipeline_response) + deserialized = self._deserialize('PagedLabPlans', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,48 +106,39 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labaccounts'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labPlans'} # type: ignore def list_by_resource_group( self, resource_group_name: str, - expand: Optional[str] = None, - filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.ResponseWithContinuationLabAccount"]: - """List lab accounts in a resource group. + **kwargs: Any + ) -> AsyncIterable["_models.PagedLabPlans"]: + """Get all lab plans for a subscription and resource group. + + Returns a list of all lab plans for a subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param expand: Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'. - :type expand: str - :param filter: The filter to apply to the operation. - :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationLabAccount or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationLabAccount] + :return: An iterator like instance of either PagedLabPlans or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.PagedLabPlans] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationLabAccount"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedLabPlans"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -172,20 +150,12 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) @@ -196,7 +166,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationLabAccount', pipeline_response) + deserialized = self._deserialize('PagedLabPlans', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -209,57 +179,56 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans'} # type: ignore async def get( self, resource_group_name: str, - lab_account_name: str, - expand: Optional[str] = None, - **kwargs - ) -> "_models.LabAccount": - """Get lab account. + lab_plan_name: str, + **kwargs: Any + ) -> "_models.LabPlan": + """Retrieves a Lab Plan resource. + + Retrieves the properties of a Lab Plan. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param expand: Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'. - :type expand: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabAccount, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.LabAccount + :return: LabPlan, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.LabPlan :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LabAccount"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -272,51 +241,39 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('LabAccount', pipeline_response) + deserialized = self._deserialize('LabPlan', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - async def create_or_update( + async def _create_or_update_initial( self, resource_group_name: str, - lab_account_name: str, - lab_account: "_models.LabAccount", - **kwargs - ) -> "_models.LabAccount": - """Create or replace an existing Lab Account. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_account: Represents a lab account. - :type lab_account: ~azure.mgmt.labservices.models.LabAccount - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabAccount, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.LabAccount - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LabAccount"] + lab_plan_name: str, + body: "_models.LabPlan", + **kwargs: Any + ) -> "_models.LabPlan": + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -330,48 +287,128 @@ async def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(lab_account, 'LabAccount') + body_content = self._serialize.body(body, 'LabPlan') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('LabAccount', pipeline_response) + deserialized = self._deserialize('LabPlan', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('LabAccount', pipeline_response) + deserialized = self._deserialize('LabPlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('LabPlan', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - async def _delete_initial( + async def begin_create_or_update( self, resource_group_name: str, - lab_account_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] + lab_plan_name: str, + body: "_models.LabPlan", + **kwargs: Any + ) -> AsyncLROPoller["_models.LabPlan"]: + """Updates or creates a Lab Plan resource. + + Operation to create or update a Lab Plan resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.LabPlan + :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 LabPlan or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.labservices.models.LabPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_plan_name=lab_plan_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LabPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + lab_plan_name: str, + body: "_models.LabPlanUpdate", + **kwargs: Any + ) -> "_models.LabPlan": + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -381,54 +418,73 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'LabPlanUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LabPlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('LabPlan', pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - async def begin_delete( + async def begin_update( self, resource_group_name: str, - lab_account_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Delete lab account. This operation can take a while to complete. + lab_plan_name: str, + body: "_models.LabPlanUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.LabPlan"]: + """Updates a Lab Plan resource. + + Operation to update a Lab Plan resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.LabPlanUpdate :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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] + :return: An instance of AsyncLROPoller that returns either LabPlan or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.labservices.models.LabPlan] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, + lab_plan_name=lab_plan_name, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -437,16 +493,19 @@ async def begin_delete( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LabPlan', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -458,43 +517,28 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - async def update( + async def _delete_initial( self, resource_group_name: str, - lab_account_name: str, - lab_account: "_models.LabAccountFragment", - **kwargs - ) -> "_models.LabAccount": - """Modify properties of lab accounts. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_account: Represents a lab account. - :type lab_account: ~azure.mgmt.labservices.models.LabAccountFragment - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabAccount, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.LabAccount - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LabAccount"] + lab_plan_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -504,64 +548,113 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(lab_account, 'LabAccountFragment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) - - deserialized = self._deserialize('LabAccount', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - async def create_lab( + async def begin_delete( self, resource_group_name: str, - lab_account_name: str, - create_lab_properties: "_models.CreateLabProperties", - **kwargs - ) -> None: - """Create a lab in a lab account. + lab_plan_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Lab Plan resource. + + Operation to delete a Lab Plan resource. Deleting a lab plan does not delete labs associated + with a lab plan, nor does it delete shared images added to a gallery via the lab plan + permission container. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param create_lab_properties: Properties for creating a managed lab and a default environment - setting. - :type create_lab_properties: ~azure.mgmt.labservices.models.CreateLabProperties + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + lab_plan_name=lab_plan_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore + + async def _save_image_initial( + self, + resource_group_name: str, + lab_plan_name: str, + body: "_models.SaveImageBody", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_lab.metadata['url'] # type: ignore + url = self._save_image_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -575,75 +668,89 @@ async def create_lab( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(create_lab_properties, 'CreateLabProperties') + body_content = self._serialize.body(body, 'SaveImageBody') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - create_lab.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/createLab'} # type: ignore + _save_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/saveImage'} # type: ignore - async def get_regional_availability( + async def begin_save_image( self, resource_group_name: str, - lab_account_name: str, - **kwargs - ) -> "_models.GetRegionalAvailabilityResponse": - """Get regional availability information for each size category configured under a lab account. + lab_plan_name: str, + body: "_models.SaveImageBody", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Save an image from a lab VM to the attached shared image gallery. + + Saves an image from a lab VM to the attached shared image gallery. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.SaveImageBody :keyword callable cls: A custom type or function that will be passed the direct response - :return: GetRegionalAvailabilityResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.GetRegionalAvailabilityResponse - :raises: ~azure.core.exceptions.HttpResponseError + :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: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GetRegionalAvailabilityResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.get_regional_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._save_image_initial( + resource_group_name=resource_group_name, + lab_plan_name=lab_plan_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) - 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) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) - deserialized = self._deserialize('GetRegionalAvailabilityResponse', pipeline_response) + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - if cls: - return cls(pipeline_response, deserialized, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + } - return deserialized - get_regional_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/getRegionalAvailability'} # type: ignore + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_save_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/saveImage'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_labs_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_labs_operations.py index b301b127c4d1..eb0657457465 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_labs_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_labs_operations.py @@ -43,41 +43,28 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - def list( + def list_by_subscription( self, - resource_group_name: str, - lab_account_name: str, - expand: Optional[str] = None, filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.ResponseWithContinuationLab"]: - """List labs in a given lab account. + **kwargs: Any + ) -> AsyncIterable["_models.PagedLabs"]: + """Get all labs for a subscription. + + Returns a list of all labs for a subscription. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param expand: Specify the $expand query. Example: 'properties($select=maxUsersInLab)'. - :type expand: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationLab or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationLab] + :return: An iterator like instance of either PagedLabs or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.PagedLabs] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationLab"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedLabs"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -87,23 +74,88 @@ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] # type: ignore + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PagedLabs', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PagedLabs"]: + """Get all labs for a subscription and resource group. + + Returns a list of all labs in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedLabs or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.PagedLabs] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedLabs"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) @@ -114,7 +166,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationLab', pipeline_response) + deserialized = self._deserialize('PagedLabs', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,34 +179,32 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs'} # type: ignore async def get( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.Lab": - """Get lab. + """Get a lab resource. - :param resource_group_name: The name of the resource group. + Returns the properties of a lab resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param expand: Specify the $expand query. Example: 'properties($select=maxUsersInLab)'. - :type expand: str :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.labservices.models.Lab @@ -165,23 +215,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -194,7 +241,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Lab', pipeline_response) @@ -202,47 +250,30 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - async def create_or_update( + async def _create_or_update_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - lab: "_models.Lab", - **kwargs + body: "_models.Lab", + **kwargs: Any ) -> "_models.Lab": - """Create or replace an existing Lab. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param lab: Represents a lab. - :type lab: ~azure.mgmt.labservices.models.Lab - :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.labservices.models.Lab - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -256,15 +287,16 @@ async def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(lab, 'Lab') + body_content = self._serialize.body(body, 'Lab') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Lab', pipeline_response) @@ -272,34 +304,111 @@ async def create_or_update( if response.status_code == 201: deserialized = self._deserialize('Lab', pipeline_response) + if response.status_code == 202: + deserialized = self._deserialize('Lab', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - async def _delete_initial( + async def begin_create_or_update( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] + body: "_models.Lab", + **kwargs: Any + ) -> AsyncLROPoller["_models.Lab"]: + """Create or update a lab resource. + + Operation to create or update a lab resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.Lab + :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 Lab or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.labservices.models.Lab] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Lab', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + lab_name: str, + body: "_models.LabUpdate", + **kwargs: Any + ) -> "_models.Lab": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -309,58 +418,73 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'LabUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Lab', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Lab', pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - async def begin_delete( + async def begin_update( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Delete lab. This operation can take a while to complete. + body: "_models.LabUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.Lab"]: + """Update a lab resource. + + Operation to update a lab resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.LabUpdate :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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] + :return: An instance of AsyncLROPoller that returns either Lab or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.labservices.models.Lab] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -369,17 +493,19 @@ async def begin_delete( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Lab', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -391,47 +517,28 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - async def update( + async def _delete_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - lab: "_models.LabFragment", - **kwargs - ) -> "_models.Lab": - """Modify properties of labs. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param lab: Represents a lab. - :type lab: ~azure.mgmt.labservices.models.LabFragment - :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.labservices.models.Lab - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -441,67 +548,109 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(lab, 'LabFragment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) - - deserialized = self._deserialize('Lab', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - async def add_users( + async def begin_delete( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - add_users_payload: "_models.AddUsersPayload", - **kwargs - ) -> None: - """Add users to a lab. + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a lab resource. - :param resource_group_name: The name of the resource group. + Operation to delete a lab resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param add_users_payload: Payload for Add Users operation on a Lab. - :type add_users_payload: ~azure.mgmt.labservices.models.AddUsersPayload :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 + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore + + async def _publish_initial( + self, + resource_group_name: str, + lab_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.add_users.metadata['url'] # type: ignore + url = self._publish_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -511,60 +660,110 @@ async def add_users( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(add_users_payload, 'AddUsersPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - add_users.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/addUsers'} # type: ignore + _publish_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/publish'} # type: ignore - async def register( + async def begin_publish( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - **kwargs - ) -> None: - """Register to managed lab. + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish or re-publish a lab. + + Publish or re-publish a lab. This will create or update all lab resources, such as virtual + machines. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_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 + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._publish_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_publish.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/publish'} # type: ignore + + async def _sync_group_initial( + self, + resource_group_name: str, + lab_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.register.metadata['url'] # type: ignore + url = self._sync_group_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -580,11 +779,79 @@ async def register( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - register.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/register'} # type: ignore + _sync_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/syncGroup'} # type: ignore + + async def begin_sync_group( + self, + resource_group_name: str, + lab_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Manually sync the lab group. + + Action used to manually kick off an AAD group sync job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._sync_group_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/syncGroup'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_operation_results_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_operation_results_operations.py new file mode 100644 index 000000000000..d1819baf2845 --- /dev/null +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_operation_results_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationResultsOperations: + """OperationResultsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.labservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + operation_result_id: str, + **kwargs: Any + ) -> Optional["_models.OperationResult"]: + """Get an azure operation result. + + Returns an azure operation result. + + :param operation_result_id: The operation result ID / name. + :type operation_result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.OperationResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'operationResultId': self._serialize.url("operation_result_id", operation_result_id, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/operationResults/{operationResultId}'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_operations.py index ea3bf1faea21..cbf0183b6d2d 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_operations.py @@ -5,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest @@ -40,60 +41,67 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def get( + def list( self, - location_name: str, - operation_name: str, - **kwargs - ) -> "_models.OperationResult": - """Get operation. - - :param location_name: The name of the location. - :type location_name: str - :param operation_name: The name of the operation. - :type operation_name: str + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Get all operations. + + Returns a list of all operations. + :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationResult, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.OperationResult + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationName': self._serialize.url("operation_name", operation_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('OperationResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{locationName}/operations/{operationName}'} # type: ignore + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.LabServices/operations'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_provider_operations_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_provider_operations_operations.py deleted file mode 100644 index 7008324f2aa6..000000000000 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_provider_operations_operations.py +++ /dev/null @@ -1,104 +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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ProviderOperationsOperations: - """ProviderOperationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.labservices.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs - ) -> AsyncIterable["_models.ProviderOperationResult"]: - """Result of the request to list REST API operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProviderOperationResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.ProviderOperationResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderOperationResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ProviderOperationResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.LabServices/operations'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_schedules_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_schedules_operations.py new file mode 100644 index 000000000000..98919de722be --- /dev/null +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_schedules_operations.py @@ -0,0 +1,468 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SchedulesOperations: + """SchedulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.labservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_lab( + self, + resource_group_name: str, + lab_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PagedSchedules"]: + """Get all schedules for a lab. + + Returns a list of all schedules for a lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param filter: The filter to apply to the operation. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedSchedules or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.PagedSchedules] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedSchedules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_lab.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PagedSchedules', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_lab.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules'} # type: ignore + + async def get( + self, + resource_group_name: str, + lab_name: str, + schedule_name: str, + **kwargs: Any + ) -> "_models.Schedule": + """Get a lab Schedule. + + Returns the properties of a lab Schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param schedule_name: The name of the schedule that uniquely identifies it within containing + lab. Used in resource URIs. + :type schedule_name: str + :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.labservices.models.Schedule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Schedule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Schedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + lab_name: str, + schedule_name: str, + body: "_models.Schedule", + **kwargs: Any + ) -> "_models.Schedule": + """Create or update a lab schedule. + + Operation to create or update a lab schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param schedule_name: The name of the schedule that uniquely identifies it within containing + lab. Used in resource URIs. + :type schedule_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.Schedule + :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.labservices.models.Schedule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Schedule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'Schedule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Schedule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Schedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + lab_name: str, + schedule_name: str, + body: "_models.ScheduleUpdate", + **kwargs: Any + ) -> "_models.Schedule": + """Update a lab schedule. + + Operation to update a lab schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param schedule_name: The name of the schedule that uniquely identifies it within containing + lab. Used in resource URIs. + :type schedule_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.ScheduleUpdate + :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.labservices.models.Schedule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Schedule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'ScheduleUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Schedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + lab_name: str, + schedule_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + lab_name: str, + schedule_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a schedule resource. + + Operation to delete a schedule resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param schedule_name: The name of the schedule that uniquely identifies it within containing + lab. Used in resource URIs. + :type schedule_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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + schedule_name=schedule_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_users_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_users_operations.py index 012b0a26415c..947edebb0a72 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_users_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_users_operations.py @@ -43,44 +43,35 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - def list( + def list_by_lab( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - expand: Optional[str] = None, filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.ResponseWithContinuationUser"]: - """List users in a given lab. + **kwargs: Any + ) -> AsyncIterable["_models.PagedUsers"]: + """Get all users for a lab. - :param resource_group_name: The name of the resource group. + Returns a list of all users for a lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param expand: Specify the $expand query. Example: 'properties($select=email)'. - :type expand: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationUser or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationUser] + :return: An iterator like instance of either PagedUsers or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.PagedUsers] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationUser"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedUsers"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -90,25 +81,18 @@ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] # type: ignore + url = self.list_by_lab.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -118,7 +102,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationUser', pipeline_response) + deserialized = self._deserialize('PagedUsers', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,37 +115,36 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users'} # type: ignore + list_by_lab.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users'} # type: ignore async def get( self, resource_group_name: str, - lab_account_name: str, lab_name: str, user_name: str, - expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.User": - """Get user. + """Get a lab user. + + Returns the properties of a lab user. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param user_name: The name of the user. + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. :type user_name: str - :param expand: Specify the $expand query. Example: 'properties($select=email)'. - :type expand: str :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.labservices.models.User @@ -172,24 +155,21 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -202,7 +182,8 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('User', pipeline_response) @@ -210,51 +191,175 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore - async def create_or_update( + async def _create_or_update_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, user_name: str, - user: "_models.User", - **kwargs + body: "_models.User", + **kwargs: Any ) -> "_models.User": - """Create or replace an existing User. + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - :param resource_group_name: The name of the resource group. + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'User') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('User', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('User', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + lab_name: str, + user_name: str, + body: "_models.User", + **kwargs: Any + ) -> AsyncLROPoller["_models.User"]: + """Create or update a lab user. + + Operation to create or update a lab user. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param user_name: The name of the user. + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. :type user_name: str - :param user: The User registered to a lab. - :type user: ~azure.mgmt.labservices.models.User + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.User :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.labservices.models.User - :raises: ~azure.core.exceptions.HttpResponseError + :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 User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.labservices.models.User] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + user_name=user_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + lab_name: str, + user_name: str, + body: "_models.UserUpdate", + **kwargs: Any + ) -> "_models.User": cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -268,52 +373,131 @@ async def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') + body_content = self._serialize.body(body, 'UserUpdate') body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('User', pipeline_response) - if response.status_code == 201: + if response.status_code == 202: deserialized = self._deserialize('User', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + lab_name: str, + user_name: str, + body: "_models.UserUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.User"]: + """Update a lab user. + + Operation to update a lab user. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. + :type user_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.UserUpdate + :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 User or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.labservices.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + user_name=user_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore async def _delete_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, user_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -329,37 +513,39 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore async def begin_delete( self, resource_group_name: str, - lab_account_name: str, lab_name: str, user_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete user. This operation can take a while to complete. + """Deletes a user resource. + + Operation to delete a user resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param user_name: The name of the user. + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. :type user_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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) @@ -376,7 +562,6 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, user_name=user_name, cls=lambda x,y,z: x, @@ -391,14 +576,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -410,51 +594,32 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore - async def update( + async def _invite_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, user_name: str, - user: "_models.UserFragment", - **kwargs - ) -> "_models.User": - """Modify properties of users. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param user_name: The name of the user. - :type user_name: str - :param user: The User registered to a lab. - :type user: ~azure.mgmt.labservices.models.UserFragment - :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.labservices.models.User - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + body: "_models.InviteBody", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._invite_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -468,20 +633,95 @@ async def update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'UserFragment') + body_content = self._serialize.body(body, 'InviteBody') body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) - - deserialized = self._deserialize('User', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + _invite_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}/invite'} # type: ignore + + async def begin_invite( + self, + resource_group_name: str, + lab_name: str, + user_name: str, + body: "_models.InviteBody", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Invite a user to a lab. + + Operation to invite a user to a lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. + :type user_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.InviteBody + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._invite_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + user_name=user_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_invite.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}/invite'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_environment_settings_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_virtual_machines_operations.py similarity index 52% rename from sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_environment_settings_operations.py rename to sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_virtual_machines_operations.py index c1fe98f96712..821392ce6937 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_environment_settings_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/aio/operations/_virtual_machines_operations.py @@ -21,8 +21,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class EnvironmentSettingsOperations: - """EnvironmentSettingsOperations async operations. +class VirtualMachinesOperations: + """VirtualMachinesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -43,44 +43,35 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - def list( + def list_by_lab( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - expand: Optional[str] = None, filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["_models.ResponseWithContinuationEnvironmentSetting"]: - """List environment setting in a given lab. + **kwargs: Any + ) -> AsyncIterable["_models.PagedVirtualMachines"]: + """Get all virtual machines for a lab. - :param resource_group_name: The name of the resource group. + Returns a list of all virtual machines for a lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param expand: Specify the $expand query. Example: 'properties($select=publishingState)'. - :type expand: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationEnvironmentSetting or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationEnvironmentSetting] + :return: An iterator like instance of either PagedVirtualMachines or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.labservices.models.PagedVirtualMachines] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationEnvironmentSetting"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedVirtualMachines"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -90,25 +81,18 @@ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] # type: ignore + url = self.list_by_lab.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -118,7 +102,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationEnvironmentSetting', pipeline_response) + deserialized = self._deserialize('PagedVirtualMachines', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,65 +115,61 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings'} # type: ignore + list_by_lab.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines'} # type: ignore async def get( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - expand: Optional[str] = None, - **kwargs - ) -> "_models.EnvironmentSetting": - """Get environment setting. + virtual_machine_name: str, + **kwargs: Any + ) -> "_models.VirtualMachine": + """Get a lab virtual machine. - :param resource_group_name: The name of the resource group. + Returns the properties for a lab virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param expand: Specify the $expand query. Example: 'properties($select=publishingState)'. - :type expand: str + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: EnvironmentSetting, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.EnvironmentSetting + :return: VirtualMachine, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.VirtualMachine :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnvironmentSetting"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -202,42 +182,39 @@ async def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) + deserialized = self._deserialize('VirtualMachine', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}'} # type: ignore - async def _create_or_update_initial( + async def _start_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - environment_setting: "_models.EnvironmentSetting", - **kwargs - ) -> "_models.EnvironmentSetting": - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnvironmentSetting"] + virtual_machine_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore + url = self._start_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -247,78 +224,63 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_setting, 'EnvironmentSetting') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) - - if response.status_code == 200: - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/start'} # type: ignore - async def begin_create_or_update( + async def begin_start( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - environment_setting: "_models.EnvironmentSetting", - **kwargs - ) -> AsyncLROPoller["_models.EnvironmentSetting"]: - """Create or replace an existing Environment Setting. This operation can take a while to complete. + virtual_machine_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start a lab virtual machine. + + Action to start a lab virtual machine. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_setting: Represents settings of an environment, from which environment - instances would be created. - :type environment_setting: ~azure.mgmt.labservices.models.EnvironmentSetting + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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 EnvironmentSetting or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.labservices.models.EnvironmentSetting] + :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: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnvironmentSetting"] + cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._start_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_setting=environment_setting, + virtual_machine_name=virtual_machine_name, cls=lambda x,y,z: x, **kwargs ) @@ -327,21 +289,17 @@ async def begin_create_or_update( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -353,32 +311,30 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/start'} # type: ignore - async def _delete_initial( + async def _stop_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - **kwargs + virtual_machine_name: str, + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore + url = self._stop_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -390,41 +346,43 @@ async def _delete_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/stop'} # type: ignore - async def begin_delete( + async def begin_stop( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - **kwargs + virtual_machine_name: str, + **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete environment setting. This operation can take a while to complete. + """Stop a lab virtual machine. - :param resource_group_name: The name of the resource group. + Action to stop a lab virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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) @@ -439,11 +397,10 @@ async def begin_delete( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._stop_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, - environment_setting_name=environment_setting_name, + virtual_machine_name=virtual_machine_name, cls=lambda x,y,z: x, **kwargs ) @@ -456,14 +413,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -475,122 +431,30 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore - - async def update( - self, - resource_group_name: str, - lab_account_name: str, - lab_name: str, - environment_setting_name: str, - environment_setting: "_models.EnvironmentSettingFragment", - **kwargs - ) -> "_models.EnvironmentSetting": - """Modify properties of environment setting. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_setting: Represents settings of an environment, from which environment - instances would be created. - :type environment_setting: ~azure.mgmt.labservices.models.EnvironmentSettingFragment - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EnvironmentSetting, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.EnvironmentSetting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnvironmentSetting"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/stop'} # type: ignore - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_setting, 'EnvironmentSettingFragment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore - - async def claim_any( + async def _reimage_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - **kwargs + virtual_machine_name: str, + **kwargs: Any ) -> None: - """Claims a random environment for a user in an environment settings. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.claim_any.metadata['url'] # type: ignore + url = self._reimage_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -606,111 +470,112 @@ async def claim_any( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - claim_any.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/claimAny'} # type: ignore + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/reimage'} # type: ignore - async def publish( + async def begin_reimage( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - publish_payload: "_models.PublishPayload", - **kwargs - ) -> None: - """Provisions/deprovisions required resources for an environment setting based on current state of - the lab/environment setting. + virtual_machine_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Re-image a lab virtual machine. - :param resource_group_name: The name of the resource group. + Re-image a lab virtual machine. The virtual machine will be deleted and recreated using the + latest published snapshot of the reference environment of the lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param publish_payload: Payload for Publish operation on EnvironmentSetting. - :type publish_payload: ~azure.mgmt.labservices.models.PublishPayload + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_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 + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.publish.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_machine_name=virtual_machine_name, + cls=lambda x,y,z: x, + **kwargs + ) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(publish_payload, 'PublishPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) - 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) + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - if cls: - return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } - publish.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/publish'} # type: ignore + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/reimage'} # type: ignore - async def _start_initial( + async def _redeploy_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - **kwargs + virtual_machine_name: str, + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self._start_initial.metadata['url'] # type: ignore + url = self._redeploy_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -728,36 +593,38 @@ async def _start_initial( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/start'} # type: ignore + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/redeploy'} # type: ignore - async def begin_start( + async def begin_redeploy( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - **kwargs + virtual_machine_name: str, + **kwargs: Any ) -> AsyncLROPoller[None]: - """Starts a template by starting all resources inside the template. This operation can take a - while to complete. + """Redeploy a lab virtual machine to a different compute node. For troubleshooting connectivity. + + Action to redeploy a lab virtual machine to a different compute node. For troubleshooting + connectivity. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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) @@ -772,11 +639,10 @@ async def begin_start( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._redeploy_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, - environment_setting_name=environment_setting_name, + virtual_machine_name=virtual_machine_name, cls=lambda x,y,z: x, **kwargs ) @@ -789,14 +655,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -808,32 +673,32 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/start'} # type: ignore + begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/redeploy'} # type: ignore - async def _stop_initial( + async def _reset_password_initial( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - **kwargs + virtual_machine_name: str, + body: "_models.ResetPasswordBody", + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore + url = self._reset_password_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -843,44 +708,52 @@ async def _stop_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.post(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'ResetPasswordBody') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/stop'} # type: ignore + _reset_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/resetPassword'} # type: ignore - async def begin_stop( + async def begin_reset_password( self, resource_group_name: str, - lab_account_name: str, lab_name: str, - environment_setting_name: str, - **kwargs + virtual_machine_name: str, + body: "_models.ResetPasswordBody", + **kwargs: Any ) -> AsyncLROPoller[None]: - """Starts a template by starting all resources inside the template. This operation can take a - while to complete. + """Reset a lab virtual machine password. - :param resource_group_name: The name of the resource group. + Resets a lab virtual machine password. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.ResetPasswordBody :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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) @@ -895,11 +768,11 @@ async def begin_stop( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._reset_password_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, - environment_setting_name=environment_setting_name, + virtual_machine_name=virtual_machine_name, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -912,14 +785,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -931,4 +803,4 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/stop'} # type: ignore + begin_reset_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/resetPassword'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/__init__.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/__init__.py index 82f6a1c4b0ee..aea070081e48 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/__init__.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/__init__.py @@ -7,227 +7,216 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import AddUsersPayload - from ._models_py3 import CloudErrorBody - from ._models_py3 import CreateLabProperties - from ._models_py3 import Environment - from ._models_py3 import EnvironmentDetails - from ._models_py3 import EnvironmentFragment - from ._models_py3 import EnvironmentOperationsPayload - from ._models_py3 import EnvironmentSetting - from ._models_py3 import EnvironmentSettingCreationParameters - from ._models_py3 import EnvironmentSettingFragment - from ._models_py3 import EnvironmentSize - from ._models_py3 import EnvironmentSizeFragment - from ._models_py3 import GalleryImage - from ._models_py3 import GalleryImageFragment - from ._models_py3 import GalleryImageReference - from ._models_py3 import GalleryImageReferenceFragment - from ._models_py3 import GetEnvironmentResponse - from ._models_py3 import GetPersonalPreferencesResponse - from ._models_py3 import GetRegionalAvailabilityResponse + from ._models_py3 import AutoShutdownProfile + from ._models_py3 import ConnectionProfile + from ._models_py3 import Credentials + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import Image + from ._models_py3 import ImageProperties + from ._models_py3 import ImageReference + from ._models_py3 import ImageUpdate + from ._models_py3 import ImageUpdateProperties + from ._models_py3 import InviteBody from ._models_py3 import Lab - from ._models_py3 import LabAccount - from ._models_py3 import LabAccountFragment - from ._models_py3 import LabCreationParameters - from ._models_py3 import LabDetails - from ._models_py3 import LabFragment - from ._models_py3 import LatestOperationResult - from ._models_py3 import ListEnvironmentsPayload - from ._models_py3 import ListEnvironmentsResponse - from ._models_py3 import ListLabsResponse - from ._models_py3 import NetworkInterface - from ._models_py3 import OperationBatchStatusPayload - from ._models_py3 import OperationBatchStatusResponse - from ._models_py3 import OperationBatchStatusResponseItem - from ._models_py3 import OperationError - from ._models_py3 import OperationMetadata - from ._models_py3 import OperationMetadataDisplay + from ._models_py3 import LabNetworkProfile + from ._models_py3 import LabPlan + from ._models_py3 import LabPlanNetworkProfile + from ._models_py3 import LabPlanProperties + from ._models_py3 import LabPlanUpdate + from ._models_py3 import LabPlanUpdateProperties + from ._models_py3 import LabProperties + from ._models_py3 import LabUpdate + from ._models_py3 import LabUpdateProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import OperationResult - from ._models_py3 import OperationStatusPayload - from ._models_py3 import OperationStatusResponse - from ._models_py3 import PersonalPreferencesOperationsPayload - from ._models_py3 import ProviderOperationResult - from ._models_py3 import PublishPayload - from ._models_py3 import ReferenceVm - from ._models_py3 import ReferenceVmCreationParameters - from ._models_py3 import ReferenceVmFragment - from ._models_py3 import RegionalAvailability - from ._models_py3 import RegisterPayload - from ._models_py3 import ResetPasswordPayload + from ._models_py3 import PagedImages + from ._models_py3 import PagedLabPlans + from ._models_py3 import PagedLabs + from ._models_py3 import PagedSchedules + from ._models_py3 import PagedUsers + from ._models_py3 import PagedVirtualMachines + from ._models_py3 import ProxyResource + from ._models_py3 import RecurrencePattern + from ._models_py3 import ResetPasswordBody from ._models_py3 import Resource - from ._models_py3 import ResourceSet - from ._models_py3 import ResourceSetFragment - from ._models_py3 import ResourceSettingCreationParameters - from ._models_py3 import ResourceSettings - from ._models_py3 import ResourceSettingsFragment - from ._models_py3 import ResponseWithContinuationEnvironment - from ._models_py3 import ResponseWithContinuationEnvironmentSetting - from ._models_py3 import ResponseWithContinuationGalleryImage - from ._models_py3 import ResponseWithContinuationLab - from ._models_py3 import ResponseWithContinuationLabAccount - from ._models_py3 import ResponseWithContinuationUser - from ._models_py3 import SizeAvailability - from ._models_py3 import SizeConfigurationProperties - from ._models_py3 import SizeConfigurationPropertiesFragment - from ._models_py3 import SizeInfo - from ._models_py3 import SizeInfoFragment + from ._models_py3 import RosterProfile + from ._models_py3 import SaveImageBody + from ._models_py3 import Schedule + from ._models_py3 import ScheduleProperties + from ._models_py3 import ScheduleUpdate + from ._models_py3 import ScheduleUpdateProperties + from ._models_py3 import SecurityProfile + from ._models_py3 import Sku + from ._models_py3 import SupportInfo + from ._models_py3 import SystemData + from ._models_py3 import TrackedResource + from ._models_py3 import TrackedResourceUpdate from ._models_py3 import User - from ._models_py3 import UserFragment - from ._models_py3 import VirtualMachineDetails - from ._models_py3 import VmStateDetails + from ._models_py3 import UserProperties + from ._models_py3 import UserUpdate + from ._models_py3 import UserUpdateProperties + from ._models_py3 import VirtualMachine + from ._models_py3 import VirtualMachineAdditionalCapabilities + from ._models_py3 import VirtualMachineConnectionProfile + from ._models_py3 import VirtualMachineProfile except (SyntaxError, ImportError): - from ._models import AddUsersPayload # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CreateLabProperties # type: ignore - from ._models import Environment # type: ignore - from ._models import EnvironmentDetails # type: ignore - from ._models import EnvironmentFragment # type: ignore - from ._models import EnvironmentOperationsPayload # type: ignore - from ._models import EnvironmentSetting # type: ignore - from ._models import EnvironmentSettingCreationParameters # type: ignore - from ._models import EnvironmentSettingFragment # type: ignore - from ._models import EnvironmentSize # type: ignore - from ._models import EnvironmentSizeFragment # type: ignore - from ._models import GalleryImage # type: ignore - from ._models import GalleryImageFragment # type: ignore - from ._models import GalleryImageReference # type: ignore - from ._models import GalleryImageReferenceFragment # type: ignore - from ._models import GetEnvironmentResponse # type: ignore - from ._models import GetPersonalPreferencesResponse # type: ignore - from ._models import GetRegionalAvailabilityResponse # type: ignore + from ._models import AutoShutdownProfile # type: ignore + from ._models import ConnectionProfile # type: ignore + from ._models import Credentials # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import Image # type: ignore + from ._models import ImageProperties # type: ignore + from ._models import ImageReference # type: ignore + from ._models import ImageUpdate # type: ignore + from ._models import ImageUpdateProperties # type: ignore + from ._models import InviteBody # type: ignore from ._models import Lab # type: ignore - from ._models import LabAccount # type: ignore - from ._models import LabAccountFragment # type: ignore - from ._models import LabCreationParameters # type: ignore - from ._models import LabDetails # type: ignore - from ._models import LabFragment # type: ignore - from ._models import LatestOperationResult # type: ignore - from ._models import ListEnvironmentsPayload # type: ignore - from ._models import ListEnvironmentsResponse # type: ignore - from ._models import ListLabsResponse # type: ignore - from ._models import NetworkInterface # type: ignore - from ._models import OperationBatchStatusPayload # type: ignore - from ._models import OperationBatchStatusResponse # type: ignore - from ._models import OperationBatchStatusResponseItem # type: ignore - from ._models import OperationError # type: ignore - from ._models import OperationMetadata # type: ignore - from ._models import OperationMetadataDisplay # type: ignore + from ._models import LabNetworkProfile # type: ignore + from ._models import LabPlan # type: ignore + from ._models import LabPlanNetworkProfile # type: ignore + from ._models import LabPlanProperties # type: ignore + from ._models import LabPlanUpdate # type: ignore + from ._models import LabPlanUpdateProperties # type: ignore + from ._models import LabProperties # type: ignore + from ._models import LabUpdate # type: ignore + from ._models import LabUpdateProperties # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore from ._models import OperationResult # type: ignore - from ._models import OperationStatusPayload # type: ignore - from ._models import OperationStatusResponse # type: ignore - from ._models import PersonalPreferencesOperationsPayload # type: ignore - from ._models import ProviderOperationResult # type: ignore - from ._models import PublishPayload # type: ignore - from ._models import ReferenceVm # type: ignore - from ._models import ReferenceVmCreationParameters # type: ignore - from ._models import ReferenceVmFragment # type: ignore - from ._models import RegionalAvailability # type: ignore - from ._models import RegisterPayload # type: ignore - from ._models import ResetPasswordPayload # type: ignore + from ._models import PagedImages # type: ignore + from ._models import PagedLabPlans # type: ignore + from ._models import PagedLabs # type: ignore + from ._models import PagedSchedules # type: ignore + from ._models import PagedUsers # type: ignore + from ._models import PagedVirtualMachines # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RecurrencePattern # type: ignore + from ._models import ResetPasswordBody # type: ignore from ._models import Resource # type: ignore - from ._models import ResourceSet # type: ignore - from ._models import ResourceSetFragment # type: ignore - from ._models import ResourceSettingCreationParameters # type: ignore - from ._models import ResourceSettings # type: ignore - from ._models import ResourceSettingsFragment # type: ignore - from ._models import ResponseWithContinuationEnvironment # type: ignore - from ._models import ResponseWithContinuationEnvironmentSetting # type: ignore - from ._models import ResponseWithContinuationGalleryImage # type: ignore - from ._models import ResponseWithContinuationLab # type: ignore - from ._models import ResponseWithContinuationLabAccount # type: ignore - from ._models import ResponseWithContinuationUser # type: ignore - from ._models import SizeAvailability # type: ignore - from ._models import SizeConfigurationProperties # type: ignore - from ._models import SizeConfigurationPropertiesFragment # type: ignore - from ._models import SizeInfo # type: ignore - from ._models import SizeInfoFragment # type: ignore + from ._models import RosterProfile # type: ignore + from ._models import SaveImageBody # type: ignore + from ._models import Schedule # type: ignore + from ._models import ScheduleProperties # type: ignore + from ._models import ScheduleUpdate # type: ignore + from ._models import ScheduleUpdateProperties # type: ignore + from ._models import SecurityProfile # type: ignore + from ._models import Sku # type: ignore + from ._models import SupportInfo # type: ignore + from ._models import SystemData # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import TrackedResourceUpdate # type: ignore from ._models import User # type: ignore - from ._models import UserFragment # type: ignore - from ._models import VirtualMachineDetails # type: ignore - from ._models import VmStateDetails # type: ignore + from ._models import UserProperties # type: ignore + from ._models import UserUpdate # type: ignore + from ._models import UserUpdateProperties # type: ignore + from ._models import VirtualMachine # type: ignore + from ._models import VirtualMachineAdditionalCapabilities # type: ignore + from ._models import VirtualMachineConnectionProfile # type: ignore + from ._models import VirtualMachineProfile # type: ignore -from ._managed_labs_client_enums import ( - AddRemove, - ConfigurationState, - LabUserAccessMode, - ManagedLabVmSize, - PublishingState, +from ._lab_services_client_enums import ( + ActionType, + ConnectionType, + CreateOption, + CreatedByType, + EnableState, + InvitationState, + LabState, + OperationStatus, + Origin, + OsState, + OsType, + ProvisioningState, + RecurrenceFrequency, + RegistrationState, + ShutdownOnIdleMode, + SkuTier, + VirtualMachineState, + VirtualMachineType, + WeekDay, ) __all__ = [ - 'AddUsersPayload', - 'CloudErrorBody', - 'CreateLabProperties', - 'Environment', - 'EnvironmentDetails', - 'EnvironmentFragment', - 'EnvironmentOperationsPayload', - 'EnvironmentSetting', - 'EnvironmentSettingCreationParameters', - 'EnvironmentSettingFragment', - 'EnvironmentSize', - 'EnvironmentSizeFragment', - 'GalleryImage', - 'GalleryImageFragment', - 'GalleryImageReference', - 'GalleryImageReferenceFragment', - 'GetEnvironmentResponse', - 'GetPersonalPreferencesResponse', - 'GetRegionalAvailabilityResponse', + 'AutoShutdownProfile', + 'ConnectionProfile', + 'Credentials', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'Image', + 'ImageProperties', + 'ImageReference', + 'ImageUpdate', + 'ImageUpdateProperties', + 'InviteBody', 'Lab', - 'LabAccount', - 'LabAccountFragment', - 'LabCreationParameters', - 'LabDetails', - 'LabFragment', - 'LatestOperationResult', - 'ListEnvironmentsPayload', - 'ListEnvironmentsResponse', - 'ListLabsResponse', - 'NetworkInterface', - 'OperationBatchStatusPayload', - 'OperationBatchStatusResponse', - 'OperationBatchStatusResponseItem', - 'OperationError', - 'OperationMetadata', - 'OperationMetadataDisplay', + 'LabNetworkProfile', + 'LabPlan', + 'LabPlanNetworkProfile', + 'LabPlanProperties', + 'LabPlanUpdate', + 'LabPlanUpdateProperties', + 'LabProperties', + 'LabUpdate', + 'LabUpdateProperties', + 'Operation', + 'OperationDisplay', + 'OperationListResult', 'OperationResult', - 'OperationStatusPayload', - 'OperationStatusResponse', - 'PersonalPreferencesOperationsPayload', - 'ProviderOperationResult', - 'PublishPayload', - 'ReferenceVm', - 'ReferenceVmCreationParameters', - 'ReferenceVmFragment', - 'RegionalAvailability', - 'RegisterPayload', - 'ResetPasswordPayload', + 'PagedImages', + 'PagedLabPlans', + 'PagedLabs', + 'PagedSchedules', + 'PagedUsers', + 'PagedVirtualMachines', + 'ProxyResource', + 'RecurrencePattern', + 'ResetPasswordBody', 'Resource', - 'ResourceSet', - 'ResourceSetFragment', - 'ResourceSettingCreationParameters', - 'ResourceSettings', - 'ResourceSettingsFragment', - 'ResponseWithContinuationEnvironment', - 'ResponseWithContinuationEnvironmentSetting', - 'ResponseWithContinuationGalleryImage', - 'ResponseWithContinuationLab', - 'ResponseWithContinuationLabAccount', - 'ResponseWithContinuationUser', - 'SizeAvailability', - 'SizeConfigurationProperties', - 'SizeConfigurationPropertiesFragment', - 'SizeInfo', - 'SizeInfoFragment', + 'RosterProfile', + 'SaveImageBody', + 'Schedule', + 'ScheduleProperties', + 'ScheduleUpdate', + 'ScheduleUpdateProperties', + 'SecurityProfile', + 'Sku', + 'SupportInfo', + 'SystemData', + 'TrackedResource', + 'TrackedResourceUpdate', 'User', - 'UserFragment', - 'VirtualMachineDetails', - 'VmStateDetails', - 'AddRemove', - 'ConfigurationState', - 'LabUserAccessMode', - 'ManagedLabVmSize', - 'PublishingState', + 'UserProperties', + 'UserUpdate', + 'UserUpdateProperties', + 'VirtualMachine', + 'VirtualMachineAdditionalCapabilities', + 'VirtualMachineConnectionProfile', + 'VirtualMachineProfile', + 'ActionType', + 'ConnectionType', + 'CreateOption', + 'CreatedByType', + 'EnableState', + 'InvitationState', + 'LabState', + 'OperationStatus', + 'Origin', + 'OsState', + 'OsType', + 'ProvisioningState', + 'RecurrenceFrequency', + 'RegistrationState', + 'ShutdownOnIdleMode', + 'SkuTier', + 'VirtualMachineState', + 'VirtualMachineType', + 'WeekDay', ] diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_lab_services_client_enums.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_lab_services_client_enums.py new file mode 100644 index 000000000000..0b39d5a4a061 --- /dev/null +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_lab_services_client_enums.py @@ -0,0 +1,241 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class ConnectionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """A connection type for access labs and VMs (Public, Private or None). + """ + + PUBLIC = "Public" + PRIVATE = "Private" + NONE = "None" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class CreateOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates what lab virtual machines are created from. + """ + + #: An image is used to create all lab user virtual machines. When this option is set, no template + #: VM will be created. + IMAGE = "Image" + #: A template VM will be used to create all lab user virtual machines. + TEMPLATE_VM = "TemplateVM" + +class EnableState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Property enabled state. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class InvitationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The lab user invitation state. + """ + + #: The invitation has not been sent. + NOT_SENT = "NotSent" + #: Currently sending the invitation. + SENDING = "Sending" + #: The invitation has been successfully sent. + SENT = "Sent" + #: There was an error while sending the invitation. + FAILED = "Failed" + +class LabState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of a virtual machine. + """ + + #: The lab is currently in draft (has not been published). + DRAFT = "Draft" + #: The lab is publishing. + PUBLISHING = "Publishing" + #: The lab is scaling. + SCALING = "Scaling" + #: The lab is syncing users. + SYNCING = "Syncing" + #: The lab has been published. + PUBLISHED = "Published" + +class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operation status + """ + + #: The operation has been accepted but hasn't started. + NOT_STARTED = "NotStarted" + #: The operation is running. + IN_PROGRESS = "InProgress" + #: The operation Succeeded. + SUCCEEDED = "Succeeded" + #: The operation failed. + FAILED = "Failed" + #: Not supported yet. + CANCELED = "Canceled" + +class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class OsState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operating system state. + """ + + #: Image does not contain any machine and user specific information. + GENERALIZED = "Generalized" + #: Image contains machine and user specific information. + SPECIALIZED = "Specialized" + +class OsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operating system type. + """ + + WINDOWS = "Windows" + LINUX = "Linux" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource provisioning state. + """ + + #: Resource is in the process of being created. + CREATING = "Creating" + #: New property values are being applied to the resource. + UPDATING = "Updating" + #: Resource is in the process of being deleted. + DELETING = "Deleting" + #: Resource is in healthy state after creation or update operation. + SUCCEEDED = "Succeeded" + #: Previous operation on the resource has failed leaving resource in unhealthy state. + FAILED = "Failed" + #: The resource is locked and changes are currently blocked. This could be due to maintenance or a + #: scheduled operation. The state will go back to succeeded once the locking operation has + #: finished. + LOCKED = "Locked" + +class RecurrenceFrequency(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Schedule recurrence frequencies. + """ + + #: Schedule will run every days. + DAILY = "Daily" + #: Schedule will run every week on days specified in weekDays. + WEEKLY = "Weekly" + +class RegistrationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The user lab registration state. + """ + + #: User has not yet registered with the lab. + REGISTERED = "Registered" + #: User has registered with the lab. + NOT_REGISTERED = "NotRegistered" + +class ShutdownOnIdleMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Defines whether to shut down VM on idle and the criteria for idle detection. + """ + + #: The VM won't be shut down when it is idle. + NONE = "None" + #: The VM will be considered as idle when there is no keyboard or mouse input. + USER_ABSENCE = "UserAbsence" + #: The VM will be considered as idle when user is absent and the resource (CPU and disk) + #: consumption is low. + LOW_USAGE = "LowUsage" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """This field is required to be implemented by the Resource Provider if the service has more than + one tier, but is not required on a PUT. + """ + + FREE = "Free" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class VirtualMachineState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of a virtual machine. + """ + + #: The VM is currently stopped. + STOPPED = "Stopped" + #: The VM is starting. + STARTING = "Starting" + #: The VM is running. + RUNNING = "Running" + #: The VM is stopping. + STOPPING = "Stopping" + #: The VM password is being reset. + RESETTING_PASSWORD = "ResettingPassword" + #: The VM is being reimaged. + REIMAGING = "Reimaging" + #: The VM is being redeployed. + REDEPLOYING = "Redeploying" + +class VirtualMachineType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the lab virtual machine. + """ + + #: A user VM. + USER = "User" + #: A template VM. + TEMPLATE = "Template" + +class WeekDay(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Days of the week. + """ + + #: Schedule will run on Sunday. + SUNDAY = "Sunday" + #: Schedule will run on Monday. + MONDAY = "Monday" + #: Schedule will run on Tuesday. + TUESDAY = "Tuesday" + #: Schedule will run on Wednesday. + WEDNESDAY = "Wednesday" + #: Schedule will run on Thursday. + THURSDAY = "Thursday" + #: Schedule will run on Friday. + FRIDAY = "Friday" + #: Schedule will run on Saturday. + SATURDAY = "Saturday" diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_managed_labs_client_enums.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_managed_labs_client_enums.py deleted file mode 100644 index 54fd195d6171..000000000000 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_managed_labs_client_enums.py +++ /dev/null @@ -1,81 +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 enum import Enum, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AddRemove(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Enum indicating if user is adding or removing a favorite lab - """ - - #: Indicates that a user is adding a favorite lab. - ADD = "Add" - #: Indicates that a user is removing a favorite lab. - REMOVE = "Remove" - -class ConfigurationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Describes the user's progress in configuring their environment setting - """ - - #: User either hasn't started configuring their template - #: or they haven't started the configuration process. - NOT_APPLICABLE = "NotApplicable" - #: User is finished modifying the template. - COMPLETED = "Completed" - -class LabUserAccessMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Lab user access mode (open to all vs. restricted to those listed on the lab). - """ - - #: Only users registered with the lab can access VMs. - RESTRICTED = "Restricted" - #: Any user can register with the lab and access its VMs. - OPEN = "Open" - -class ManagedLabVmSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The size category - """ - - #: The base VM size. - BASIC = "Basic" - #: The standard or default VM size. - STANDARD = "Standard" - #: The most performant VM size. - PERFORMANCE = "Performance" - -class PublishingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Describes the readiness of this environment setting - """ - - #: Initial state of an environment setting. - DRAFT = "Draft" - #: Currently provisioning resources. - PUBLISHING = "Publishing" - #: All resources are currently provisioned. - PUBLISHED = "Published" - #: Failed to provision all the necessary resources. - PUBLISH_FAILED = "PublishFailed" - #: Currently provisioning resources without recreating VM image. - SCALING = "Scaling" diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_models.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_models.py index b7717686ab1a..afda134fcf02 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_models.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_models.py @@ -6,338 +6,226 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from azure.core.exceptions import HttpResponseError import msrest.serialization -class AddUsersPayload(msrest.serialization.Model): - """Payload for Add Users operation on a Lab. +class AutoShutdownProfile(msrest.serialization.Model): + """Profile for how to handle shutting down virtual machines. - All required parameters must be populated in order to send to Azure. - - :param email_addresses: Required. List of user emails addresses to add to the lab. - :type email_addresses: list[str] + :param shutdown_on_disconnect: Whether shutdown on disconnect is enabled. Possible values + include: "Enabled", "Disabled". + :type shutdown_on_disconnect: str or ~azure.mgmt.labservices.models.EnableState + :param shutdown_when_not_connected: Whether a VM will get shutdown when it hasn't been + connected to after a period of time. Possible values include: "Enabled", "Disabled". + :type shutdown_when_not_connected: str or ~azure.mgmt.labservices.models.EnableState + :param shutdown_on_idle: Whether a VM will get shutdown when it has idled for a period of time. + Possible values include: "None", "UserAbsence", "LowUsage". + :type shutdown_on_idle: str or ~azure.mgmt.labservices.models.ShutdownOnIdleMode + :param disconnect_delay: The amount of time a VM will stay running after a user disconnects if + this behavior is enabled. + :type disconnect_delay: ~datetime.timedelta + :param no_connect_delay: The amount of time a VM will stay running before it is shutdown if no + connection is made and this behavior is enabled. + :type no_connect_delay: ~datetime.timedelta + :param idle_delay: The amount of time a VM will idle before it is shutdown if this behavior is + enabled. + :type idle_delay: ~datetime.timedelta """ - _validation = { - 'email_addresses': {'required': True}, - } - _attribute_map = { - 'email_addresses': {'key': 'emailAddresses', 'type': '[str]'}, + 'shutdown_on_disconnect': {'key': 'shutdownOnDisconnect', 'type': 'str'}, + 'shutdown_when_not_connected': {'key': 'shutdownWhenNotConnected', 'type': 'str'}, + 'shutdown_on_idle': {'key': 'shutdownOnIdle', 'type': 'str'}, + 'disconnect_delay': {'key': 'disconnectDelay', 'type': 'duration'}, + 'no_connect_delay': {'key': 'noConnectDelay', 'type': 'duration'}, + 'idle_delay': {'key': 'idleDelay', 'type': 'duration'}, } def __init__( self, **kwargs ): - super(AddUsersPayload, self).__init__(**kwargs) - self.email_addresses = kwargs['email_addresses'] + super(AutoShutdownProfile, self).__init__(**kwargs) + self.shutdown_on_disconnect = kwargs.get('shutdown_on_disconnect', None) + self.shutdown_when_not_connected = kwargs.get('shutdown_when_not_connected', None) + self.shutdown_on_idle = kwargs.get('shutdown_on_idle', None) + self.disconnect_delay = kwargs.get('disconnect_delay', None) + self.no_connect_delay = kwargs.get('no_connect_delay', None) + self.idle_delay = kwargs.get('idle_delay', None) -class CloudErrorBody(msrest.serialization.Model): - """Body of an error from a REST request. +class ConnectionProfile(msrest.serialization.Model): + """Connection profile for how users connect to lab virtual machines. - :param code: - :type code: str - :param message: - :type message: str - :param target: - :type target: str - :param details: Inner errors. - :type details: list[~azure.mgmt.labservices.models.CloudErrorBody] + :param web_ssh_access: The enabled access level for Web Access over SSH. Possible values + include: "Public", "Private", "None". + :type web_ssh_access: str or ~azure.mgmt.labservices.models.ConnectionType + :param web_rdp_access: The enabled access level for Web Access over RDP. Possible values + include: "Public", "Private", "None". + :type web_rdp_access: str or ~azure.mgmt.labservices.models.ConnectionType + :param client_ssh_access: The enabled access level for Client Access over SSH. Possible values + include: "Public", "Private", "None". + :type client_ssh_access: str or ~azure.mgmt.labservices.models.ConnectionType + :param client_rdp_access: The enabled access level for Client Access over RDP. Possible values + include: "Public", "Private", "None". + :type client_rdp_access: str or ~azure.mgmt.labservices.models.ConnectionType """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + 'web_ssh_access': {'key': 'webSshAccess', 'type': 'str'}, + 'web_rdp_access': {'key': 'webRdpAccess', 'type': 'str'}, + 'client_ssh_access': {'key': 'clientSshAccess', 'type': 'str'}, + 'client_rdp_access': {'key': 'clientRdpAccess', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) + super(ConnectionProfile, self).__init__(**kwargs) + self.web_ssh_access = kwargs.get('web_ssh_access', None) + self.web_rdp_access = kwargs.get('web_rdp_access', None) + self.client_ssh_access = kwargs.get('client_ssh_access', None) + self.client_rdp_access = kwargs.get('client_rdp_access', None) -class CreateLabProperties(msrest.serialization.Model): - """Properties for creating a managed lab and a default environment setting. +class Credentials(msrest.serialization.Model): + """Credentials for a user on a lab VM. All required parameters must be populated in order to send to Azure. - :param environment_setting_creation_parameters: Settings related to creating an environment - setting. - :type environment_setting_creation_parameters: - ~azure.mgmt.labservices.models.EnvironmentSettingCreationParameters - :param lab_creation_parameters: Required. Settings related to creating a lab. - :type lab_creation_parameters: ~azure.mgmt.labservices.models.LabCreationParameters - :param name: Required. The name of the resource. - :type name: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :param username: Required. The username to use when signing in to lab VMs. + :type username: str + :param password: The password for the user. This is required for the TemplateVM createOption. + :type password: str """ _validation = { - 'lab_creation_parameters': {'required': True}, - 'name': {'required': True}, + 'username': {'required': True}, } _attribute_map = { - 'environment_setting_creation_parameters': {'key': 'environmentSettingCreationParameters', 'type': 'EnvironmentSettingCreationParameters'}, - 'lab_creation_parameters': {'key': 'labCreationParameters', 'type': 'LabCreationParameters'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CreateLabProperties, self).__init__(**kwargs) - self.environment_setting_creation_parameters = kwargs.get('environment_setting_creation_parameters', None) - self.lab_creation_parameters = kwargs['lab_creation_parameters'] - self.name = kwargs['name'] - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) + super(Credentials, self).__init__(**kwargs) + self.username = kwargs['username'] + self.password = kwargs.get('password', None) -class Resource(msrest.serialization.Model): - """An Azure resource. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. 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. - :vartype name: str - :ivar type: The type of the resource. + :ivar type: The additional info type. :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :ivar info: The additional info. + :vartype info: any """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, 'type': {'readonly': True}, + 'info': {'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}'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, **kwargs ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None + super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) + self.info = None -class Environment(Resource): - """Represents an environment instance. +class ErrorDetail(msrest.serialization.Model): + """The error detail. 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. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param resource_sets: The set of a VM and the setting id it was created for. - :type resource_sets: ~azure.mgmt.labservices.models.ResourceSet - :ivar claimed_by_user_object_id: The AAD object Id of the user who has claimed the environment. - :vartype claimed_by_user_object_id: str - :ivar claimed_by_user_principal_id: The user principal Id of the user who has claimed the - environment. - :vartype claimed_by_user_principal_id: str - :ivar claimed_by_user_name: The name or email address of the user who has claimed the - environment. - :vartype claimed_by_user_name: str - :ivar is_claimed: Is the environment claimed or not. - :vartype is_claimed: bool - :ivar last_known_power_state: Last known power state of the environment. - :vartype last_known_power_state: str - :ivar network_interface: Network details of the environment. - :vartype network_interface: ~azure.mgmt.labservices.models.NetworkInterface - :ivar total_usage: How long the environment has been used by a lab user. - :vartype total_usage: ~datetime.timedelta - :ivar password_last_reset: When the password was last reset on the environment. - :vartype password_last_reset: ~datetime.datetime - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.labservices.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.labservices.models.ErrorAdditionalInfo] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'claimed_by_user_object_id': {'readonly': True}, - 'claimed_by_user_principal_id': {'readonly': True}, - 'claimed_by_user_name': {'readonly': True}, - 'is_claimed': {'readonly': True}, - 'last_known_power_state': {'readonly': True}, - 'network_interface': {'readonly': True}, - 'total_usage': {'readonly': True}, - 'password_last_reset': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'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}'}, - 'resource_sets': {'key': 'properties.resourceSets', 'type': 'ResourceSet'}, - 'claimed_by_user_object_id': {'key': 'properties.claimedByUserObjectId', 'type': 'str'}, - 'claimed_by_user_principal_id': {'key': 'properties.claimedByUserPrincipalId', 'type': 'str'}, - 'claimed_by_user_name': {'key': 'properties.claimedByUserName', 'type': 'str'}, - 'is_claimed': {'key': 'properties.isClaimed', 'type': 'bool'}, - 'last_known_power_state': {'key': 'properties.lastKnownPowerState', 'type': 'str'}, - 'network_interface': {'key': 'properties.networkInterface', 'type': 'NetworkInterface'}, - 'total_usage': {'key': 'properties.totalUsage', 'type': 'duration'}, - 'password_last_reset': {'key': 'properties.passwordLastReset', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, **kwargs ): - super(Environment, self).__init__(**kwargs) - self.resource_sets = kwargs.get('resource_sets', None) - self.claimed_by_user_object_id = None - self.claimed_by_user_principal_id = None - self.claimed_by_user_name = None - self.is_claimed = None - self.last_known_power_state = None - self.network_interface = None - self.total_usage = None - self.password_last_reset = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - self.latest_operation_result = None + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None -class EnvironmentDetails(msrest.serialization.Model): - """This represents the details about a User's environment and its state. +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Environment. - :vartype name: str - :ivar description: Description of the Environment. - :vartype description: str - :ivar id: Resource Id of the environment. - :vartype id: str - :ivar provisioning_state: The provisioning state of the environment. This also includes - LabIsFull and NotYetProvisioned status. - :vartype provisioning_state: str - :ivar virtual_machine_details: Details of backing DTL virtual machine with compute and network - details. - :vartype virtual_machine_details: ~azure.mgmt.labservices.models.VirtualMachineDetails - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult - :ivar environment_state: Publishing state of the environment setting Possible values are - Creating, Created, Failed. - :vartype environment_state: str - :ivar total_usage: How long the environment has been used by a lab user. - :vartype total_usage: ~datetime.timedelta - :ivar password_last_reset: When the password was last reset on the environment. - :vartype password_last_reset: ~datetime.datetime + :param error: The error object. + :type error: ~azure.mgmt.labservices.models.ErrorDetail """ - _validation = { - 'name': {'readonly': True}, - 'description': {'readonly': True}, - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'virtual_machine_details': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, - 'environment_state': {'readonly': True}, - 'total_usage': {'readonly': True}, - 'password_last_reset': {'readonly': True}, - } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'virtual_machine_details': {'key': 'virtualMachineDetails', 'type': 'VirtualMachineDetails'}, - 'latest_operation_result': {'key': 'latestOperationResult', 'type': 'LatestOperationResult'}, - 'environment_state': {'key': 'environmentState', 'type': 'str'}, - 'total_usage': {'key': 'totalUsage', 'type': 'duration'}, - 'password_last_reset': {'key': 'passwordLastReset', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, **kwargs ): - super(EnvironmentDetails, self).__init__(**kwargs) - self.name = None - self.description = None - self.id = None - self.provisioning_state = None - self.virtual_machine_details = None - self.latest_operation_result = None - self.environment_state = None - self.total_usage = None - self.password_last_reset = None + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) -class EnvironmentFragment(Resource): - """Represents an environment instance. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param resource_sets: The set of a VM and the setting id it was created for. - :type resource_sets: ~azure.mgmt.labservices.models.ResourceSetFragment - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str """ _validation = { @@ -350,1182 +238,1127 @@ class EnvironmentFragment(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}'}, - 'resource_sets': {'key': 'properties.resourceSets', 'type': 'ResourceSetFragment'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, } def __init__( self, **kwargs ): - super(EnvironmentFragment, self).__init__(**kwargs) - self.resource_sets = kwargs.get('resource_sets', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - - -class EnvironmentOperationsPayload(msrest.serialization.Model): - """Represents payload for any Environment operations like get, start, stop, connect. - - All required parameters must be populated in order to send to Azure. - - :param environment_id: Required. The resourceId of the environment. - :type environment_id: str - """ - - _validation = { - 'environment_id': {'required': True}, - } - - _attribute_map = { - 'environment_id': {'key': 'environmentId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EnvironmentOperationsPayload, self).__init__(**kwargs) - self.environment_id = kwargs['environment_id'] + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class EnvironmentSetting(Resource): - """Represents settings of an environment, from which environment instances would be created. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar publishing_state: Describes the readiness of this environment setting. Possible values - include: "Draft", "Publishing", "Published", "PublishFailed", "Scaling". - :vartype publishing_state: str or ~azure.mgmt.labservices.models.PublishingState - :param configuration_state: Describes the user's progress in configuring their environment - setting. Possible values include: "NotApplicable", "Completed". - :type configuration_state: str or ~azure.mgmt.labservices.models.ConfigurationState - :param description: Describes the environment and its resource settings. - :type description: str - :param title: Brief title describing the environment and its resource settings. - :type title: str - :param resource_settings: The resource specific settings. - :type resource_settings: ~azure.mgmt.labservices.models.ResourceSettings - :ivar last_changed: Time when the template VM was last changed. - :vartype last_changed: ~datetime.datetime - :ivar last_published: Time when the template VM was last sent for publishing. - :vartype last_published: ~datetime.datetime - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_state': {'readonly': True}, - 'last_changed': {'readonly': True}, - 'last_published': {'readonly': True}, - 'latest_operation_result': {'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}'}, - 'publishing_state': {'key': 'properties.publishingState', 'type': 'str'}, - 'configuration_state': {'key': 'properties.configurationState', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'resource_settings': {'key': 'properties.resourceSettings', 'type': 'ResourceSettings'}, - 'last_changed': {'key': 'properties.lastChanged', 'type': 'iso-8601'}, - 'last_published': {'key': 'properties.lastPublished', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, - } - - def __init__( - self, - **kwargs - ): - super(EnvironmentSetting, self).__init__(**kwargs) - self.publishing_state = None - self.configuration_state = kwargs.get('configuration_state', None) - self.description = kwargs.get('description', None) - self.title = kwargs.get('title', None) - self.resource_settings = kwargs.get('resource_settings', None) - self.last_changed = None - self.last_published = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - self.latest_operation_result = None - - -class EnvironmentSettingCreationParameters(msrest.serialization.Model): - """Settings related to creating an environment setting. - - All required parameters must be populated in order to send to Azure. - - :param resource_setting_creation_parameters: Required. The resource specific settings. - :type resource_setting_creation_parameters: - ~azure.mgmt.labservices.models.ResourceSettingCreationParameters - """ - - _validation = { - 'resource_setting_creation_parameters': {'required': True}, - } - - _attribute_map = { - 'resource_setting_creation_parameters': {'key': 'resourceSettingCreationParameters', 'type': 'ResourceSettingCreationParameters'}, } def __init__( self, **kwargs ): - super(EnvironmentSettingCreationParameters, self).__init__(**kwargs) - self.resource_setting_creation_parameters = kwargs['resource_setting_creation_parameters'] + super(ProxyResource, self).__init__(**kwargs) -class EnvironmentSettingFragment(Resource): - """Represents settings of an environment, from which environment instances would be created. +class Image(ProxyResource): + """Lab services virtual machine image. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param configuration_state: Describes the user's progress in configuring their environment - setting. Possible values include: "NotApplicable", "Completed". - :type configuration_state: str or ~azure.mgmt.labservices.models.ConfigurationState - :param description: Describes the environment and its resource settings. - :type description: str - :param title: Brief title describing the environment and its resource settings. - :type title: str - :param resource_settings: The resource specific settings. - :type resource_settings: ~azure.mgmt.labservices.models.ResourceSettingsFragment - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str + :ivar system_data: Metadata pertaining to creation and last modification of the image. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param enabled_state: Is the image enabled. Possible values include: "Enabled", "Disabled". + :type enabled_state: str or ~azure.mgmt.labservices.models.EnableState + :ivar provisioning_state: Current provisioning state of the image. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar display_name: The image display name. + :vartype display_name: str + :ivar description: A description of the image. + :vartype description: str + :ivar icon_url: URL of the image icon. + :vartype icon_url: str + :ivar author: The image author. + :vartype author: str + :ivar os_type: The OS Type of the image. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.labservices.models.OsType + :ivar plan: The ID of marketplace plan associated with the image (optional). + :vartype plan: str + :ivar terms_status: The status of image terms of use (enabled = accepted, disabled = not + accepted). Possible values include: "Enabled", "Disabled". + :vartype terms_status: str or ~azure.mgmt.labservices.models.EnableState + :ivar offer: The ID of an offer associated with the image. + :vartype offer: str + :ivar publisher: The ID of the publisher of the image. + :vartype publisher: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar version: The image version. + :vartype version: str + :ivar shared_gallery_id: The ID for the image in the shared gallery. + :vartype shared_gallery_id: str + :param available_regions: The available regions of the image in the shared gallery. + :type available_regions: list[str] + :ivar os_state: The OS State of the image. Possible values include: "Generalized", + "Specialized". + :vartype os_state: str or ~azure.mgmt.labservices.models.OsState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'icon_url': {'readonly': True}, + 'author': {'readonly': True}, + 'os_type': {'readonly': True}, + 'plan': {'readonly': True}, + 'terms_status': {'readonly': True}, + 'offer': {'readonly': True}, + 'publisher': {'readonly': True}, + 'sku': {'readonly': True}, + 'version': {'readonly': True}, + 'shared_gallery_id': {'readonly': True, 'max_length': 2000, 'min_length': 3}, + 'os_state': {'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}'}, - 'configuration_state': {'key': 'properties.configurationState', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'resource_settings': {'key': 'properties.resourceSettings', 'type': 'ResourceSettingsFragment'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EnvironmentSettingFragment, self).__init__(**kwargs) - self.configuration_state = kwargs.get('configuration_state', None) - self.description = kwargs.get('description', None) - self.title = kwargs.get('title', None) - self.resource_settings = kwargs.get('resource_settings', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - - -class EnvironmentSize(msrest.serialization.Model): - """Represents a size category supported by this Lab Account (small, medium or large). - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The size category. Possible values include: "Basic", "Standard", "Performance". - :type name: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param vm_sizes: Represents a set of compute sizes that can serve this given size type. - :type vm_sizes: list[~azure.mgmt.labservices.models.SizeInfo] - :ivar max_price: The pay-as-you-go dollar price per hour this size will cost. It does not - include discounts and may not reflect the actual price the size will cost. This is the maximum - price of all prices within this tier. - :vartype max_price: float - :ivar min_number_of_cores: The number of cores a VM of this size has. This is the minimum - number of cores within this tier. - :vartype min_number_of_cores: int - :ivar min_memory: The amount of memory available (in GB). This is the minimum amount of memory - within this tier. - :vartype min_memory: float - """ - - _validation = { - 'max_price': {'readonly': True}, - 'min_number_of_cores': {'readonly': True}, - 'min_memory': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'vm_sizes': {'key': 'vmSizes', 'type': '[SizeInfo]'}, - 'max_price': {'key': 'maxPrice', 'type': 'float'}, - 'min_number_of_cores': {'key': 'minNumberOfCores', 'type': 'int'}, - 'min_memory': {'key': 'minMemory', 'type': 'float'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'icon_url': {'key': 'properties.iconUrl', 'type': 'str'}, + 'author': {'key': 'properties.author', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'plan': {'key': 'properties.plan', 'type': 'str'}, + 'terms_status': {'key': 'properties.termsStatus', 'type': 'str'}, + 'offer': {'key': 'properties.offer', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'sku': {'key': 'properties.sku', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'shared_gallery_id': {'key': 'properties.sharedGalleryId', 'type': 'str'}, + 'available_regions': {'key': 'properties.availableRegions', 'type': '[str]'}, + 'os_state': {'key': 'properties.osState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(EnvironmentSize, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.vm_sizes = kwargs.get('vm_sizes', None) - self.max_price = None - self.min_number_of_cores = None - self.min_memory = None + super(Image, self).__init__(**kwargs) + self.system_data = None + self.enabled_state = kwargs.get('enabled_state', None) + self.provisioning_state = None + self.display_name = None + self.description = None + self.icon_url = None + self.author = None + self.os_type = None + self.plan = None + self.terms_status = None + self.offer = None + self.publisher = None + self.sku = None + self.version = None + self.shared_gallery_id = None + self.available_regions = kwargs.get('available_regions', None) + self.os_state = None -class EnvironmentSizeFragment(msrest.serialization.Model): - """Represents a size category supported by this Lab Account (small, medium or large). +class ImageUpdateProperties(msrest.serialization.Model): + """Properties of an image resource update. - :param name: The size category. Possible values include: "Basic", "Standard", "Performance". - :type name: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param vm_sizes: Represents a set of compute sizes that can serve this given size type. - :type vm_sizes: list[~azure.mgmt.labservices.models.SizeInfoFragment] + :param enabled_state: Is the image enabled. Possible values include: "Enabled", "Disabled". + :type enabled_state: str or ~azure.mgmt.labservices.models.EnableState """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'vm_sizes': {'key': 'vmSizes', 'type': '[SizeInfoFragment]'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(EnvironmentSizeFragment, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.vm_sizes = kwargs.get('vm_sizes', None) + super(ImageUpdateProperties, self).__init__(**kwargs) + self.enabled_state = kwargs.get('enabled_state', None) -class GalleryImage(Resource): - """Represents an image from the Azure Marketplace. +class ImageProperties(ImageUpdateProperties): + """Properties of an image resource. 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. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :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. + :param enabled_state: Is the image enabled. Possible values include: "Enabled", "Disabled". + :type enabled_state: str or ~azure.mgmt.labservices.models.EnableState + :ivar provisioning_state: Current provisioning state of the image. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar display_name: The image display name. + :vartype display_name: str + :ivar description: A description of the image. :vartype description: str - :ivar image_reference: The image reference of the gallery image. - :vartype image_reference: ~azure.mgmt.labservices.models.GalleryImageReference - :ivar icon: The icon of the gallery image. - :vartype icon: str - :param is_enabled: Indicates whether this gallery image is enabled. - :type is_enabled: bool - :param is_override: Indicates whether this gallery has been overridden for this lab account. - :type is_override: bool - :ivar plan_id: The third party plan that applies to this image. - :vartype plan_id: str - :param is_plan_authorized: Indicates if the plan has been authorized for programmatic - deployment. - :type is_plan_authorized: bool - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult + :ivar icon_url: URL of the image icon. + :vartype icon_url: str + :ivar author: The image author. + :vartype author: str + :ivar os_type: The OS Type of the image. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.labservices.models.OsType + :ivar plan: The ID of marketplace plan associated with the image (optional). + :vartype plan: str + :ivar terms_status: The status of image terms of use (enabled = accepted, disabled = not + accepted). Possible values include: "Enabled", "Disabled". + :vartype terms_status: str or ~azure.mgmt.labservices.models.EnableState + :ivar offer: The ID of an offer associated with the image. + :vartype offer: str + :ivar publisher: The ID of the publisher of the image. + :vartype publisher: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar version: The image version. + :vartype version: str + :ivar shared_gallery_id: The ID for the image in the shared gallery. + :vartype shared_gallery_id: str + :param available_regions: The available regions of the image in the shared gallery. + :type available_regions: list[str] + :ivar os_state: The OS State of the image. Possible values include: "Generalized", + "Specialized". + :vartype os_state: str or ~azure.mgmt.labservices.models.OsState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'author': {'readonly': True}, - 'created_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'display_name': {'readonly': True}, 'description': {'readonly': True}, - 'image_reference': {'readonly': True}, - 'icon': {'readonly': True}, - 'plan_id': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, + 'icon_url': {'readonly': True}, + 'author': {'readonly': True}, + 'os_type': {'readonly': True}, + 'plan': {'readonly': True}, + 'terms_status': {'readonly': True}, + 'offer': {'readonly': True}, + 'publisher': {'readonly': True}, + 'sku': {'readonly': True}, + 'version': {'readonly': True}, + 'shared_gallery_id': {'readonly': True, 'max_length': 2000, 'min_length': 3}, + 'os_state': {'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}'}, - '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'}, - 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, - 'is_override': {'key': 'properties.isOverride', 'type': 'bool'}, - 'plan_id': {'key': 'properties.planId', 'type': 'str'}, - 'is_plan_authorized': {'key': 'properties.isPlanAuthorized', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'icon_url': {'key': 'iconUrl', 'type': 'str'}, + 'author': {'key': 'author', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'plan': {'key': 'plan', 'type': 'str'}, + 'terms_status': {'key': 'termsStatus', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'shared_gallery_id': {'key': 'sharedGalleryId', 'type': 'str'}, + 'available_regions': {'key': 'availableRegions', 'type': '[str]'}, + 'os_state': {'key': 'osState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(GalleryImage, self).__init__(**kwargs) - self.author = None - self.created_date = None + super(ImageProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.display_name = None self.description = None - self.image_reference = None - self.icon = None - self.is_enabled = kwargs.get('is_enabled', None) - self.is_override = kwargs.get('is_override', None) - self.plan_id = None - self.is_plan_authorized = kwargs.get('is_plan_authorized', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - self.latest_operation_result = None + self.icon_url = None + self.author = None + self.os_type = None + self.plan = None + self.terms_status = None + self.offer = None + self.publisher = None + self.sku = None + self.version = None + self.shared_gallery_id = None + self.available_regions = kwargs.get('available_regions', None) + self.os_state = None -class GalleryImageFragment(Resource): - """Represents an image from the Azure Marketplace. +class ImageReference(msrest.serialization.Model): + """Image reference information. Used in the virtual machine profile. 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. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param is_enabled: Indicates whether this gallery image is enabled. - :type is_enabled: bool - :param is_override: Indicates whether this gallery has been overridden for this lab account. - :type is_override: bool - :param is_plan_authorized: Indicates if the plan has been authorized for programmatic - deployment. - :type is_plan_authorized: bool - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, - 'is_override': {'key': 'properties.isOverride', 'type': 'bool'}, - 'is_plan_authorized': {'key': 'properties.isPlanAuthorized', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GalleryImageFragment, self).__init__(**kwargs) - self.is_enabled = kwargs.get('is_enabled', None) - self.is_override = kwargs.get('is_override', None) - self.is_plan_authorized = kwargs.get('is_plan_authorized', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - - -class GalleryImageReference(msrest.serialization.Model): - """The reference information for an Azure Marketplace image. - - :param offer: The offer of the gallery image. + :param id: Image resource ID. + :type id: str + :param offer: The image offer if applicable. :type offer: str - :param publisher: The publisher of the gallery image. + :param publisher: The image publisher. :type publisher: str - :param sku: The SKU of the gallery image. + :param sku: The image SKU. :type sku: str - :param os_type: The OS type of the gallery image. - :type os_type: str - :param version: The version of the gallery image. + :param version: The image version specified on creation. :type version: str + :ivar exact_version: The actual version of the image after use. + :vartype exact_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'}, + _validation = { + 'id': {'max_length': 2000, 'min_length': 3}, + 'exact_version': {'readonly': True}, } - def __init__( - self, - **kwargs - ): - super(GalleryImageReference, self).__init__(**kwargs) - self.offer = kwargs.get('offer', None) - self.publisher = kwargs.get('publisher', None) - self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) - self.version = kwargs.get('version', None) - - -class GalleryImageReferenceFragment(msrest.serialization.Model): - """The reference information for an Azure Marketplace image. - - :param offer: The offer of the gallery image. - :type offer: str - :param publisher: The publisher of the gallery image. - :type publisher: str - :param sku: The SKU of the gallery image. - :type sku: str - :param os_type: The OS type of the gallery image. - :type os_type: str - :param version: The version of the gallery image. - :type version: str - """ - _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, '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'}, + 'exact_version': {'key': 'exactVersion', 'type': 'str'}, } def __init__( self, **kwargs ): - super(GalleryImageReferenceFragment, self).__init__(**kwargs) + super(ImageReference, self).__init__(**kwargs) + self.id = kwargs.get('id', None) self.offer = kwargs.get('offer', None) self.publisher = kwargs.get('publisher', None) self.sku = kwargs.get('sku', None) - self.os_type = kwargs.get('os_type', None) self.version = kwargs.get('version', None) + self.exact_version = None -class GetEnvironmentResponse(msrest.serialization.Model): - """Represents the environments details. - - Variables are only populated by the server, and will be ignored when sending a request. +class ImageUpdate(msrest.serialization.Model): + """Lab services virtual machine image for updates. - :ivar environment: Details of the environment. - :vartype environment: ~azure.mgmt.labservices.models.EnvironmentDetails + :param enabled_state: Is the image enabled. Possible values include: "Enabled", "Disabled". + :type enabled_state: str or ~azure.mgmt.labservices.models.EnableState """ - _validation = { - 'environment': {'readonly': True}, - } - _attribute_map = { - 'environment': {'key': 'environment', 'type': 'EnvironmentDetails'}, + 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(GetEnvironmentResponse, self).__init__(**kwargs) - self.environment = None + super(ImageUpdate, self).__init__(**kwargs) + self.enabled_state = kwargs.get('enabled_state', None) -class GetPersonalPreferencesResponse(msrest.serialization.Model): - """Represents the PersonalPreferences for the user. +class InviteBody(msrest.serialization.Model): + """Body for a user invite request. - :param id: Id to be used by the cache orchestrator. - :type id: str - :param favorite_lab_resource_ids: Array of favorite lab resource ids. - :type favorite_lab_resource_ids: list[str] + :param text: Custom text for the invite email. + :type text: str """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'favorite_lab_resource_ids': {'key': 'favoriteLabResourceIds', 'type': '[str]'}, + 'text': {'key': 'text', 'type': 'str'}, } def __init__( self, **kwargs ): - super(GetPersonalPreferencesResponse, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.favorite_lab_resource_ids = kwargs.get('favorite_lab_resource_ids', None) - + super(InviteBody, self).__init__(**kwargs) + self.text = kwargs.get('text', None) -class GetRegionalAvailabilityResponse(msrest.serialization.Model): - """The response model from the GetRegionalAvailability action. - :param regional_availability: Availability information for different size categories per - region. - :type regional_availability: list[~azure.mgmt.labservices.models.RegionalAvailability] - """ - - _attribute_map = { - 'regional_availability': {'key': 'regionalAvailability', 'type': '[RegionalAvailability]'}, - } - - def __init__( - self, - **kwargs - ): - super(GetRegionalAvailabilityResponse, self).__init__(**kwargs) - self.regional_availability = kwargs.get('regional_availability', None) - - -class Lab(Resource): - """Represents a lab. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. 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. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param max_users_in_lab: Maximum number of users allowed in the lab. - :type max_users_in_lab: int - :ivar user_quota: Maximum value MaxUsersInLab can be set to, as specified by the service. - :vartype user_quota: int - :ivar invitation_code: Invitation code that users can use to join a lab. - :vartype invitation_code: str - :ivar created_by_object_id: Object id of the user that created the lab. - :vartype created_by_object_id: str - :param usage_quota: Maximum duration a user can use an environment for in the lab. - :type usage_quota: ~datetime.timedelta - :param user_access_mode: Lab user access mode (open to all vs. restricted to those listed on - the lab). Possible values include: "Restricted", "Open". - :type user_access_mode: str or ~azure.mgmt.labservices.models.LabUserAccessMode - :ivar created_by_user_principal_name: Lab creator name. - :vartype created_by_user_principal_name: str - :ivar created_date: Creation date for the lab. - :vartype created_date: ~datetime.datetime - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'user_quota': {'readonly': True}, - 'invitation_code': {'readonly': True}, - 'created_by_object_id': {'readonly': True}, - 'created_by_user_principal_name': {'readonly': True}, - 'created_date': {'readonly': True}, - 'latest_operation_result': {'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}'}, - 'max_users_in_lab': {'key': 'properties.maxUsersInLab', 'type': 'int'}, - 'user_quota': {'key': 'properties.userQuota', 'type': 'int'}, - 'invitation_code': {'key': 'properties.invitationCode', 'type': 'str'}, - 'created_by_object_id': {'key': 'properties.createdByObjectId', 'type': 'str'}, - 'usage_quota': {'key': 'properties.usageQuota', 'type': 'duration'}, - 'user_access_mode': {'key': 'properties.userAccessMode', 'type': 'str'}, - 'created_by_user_principal_name': {'key': 'properties.createdByUserPrincipalName', 'type': 'str'}, - 'created_date': {'key': 'properties.createdDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, - } - - def __init__( - self, - **kwargs - ): - super(Lab, self).__init__(**kwargs) - self.max_users_in_lab = kwargs.get('max_users_in_lab', None) - self.user_quota = None - self.invitation_code = None - self.created_by_object_id = None - self.usage_quota = kwargs.get('usage_quota', None) - self.user_access_mode = kwargs.get('user_access_mode', None) - self.created_by_user_principal_name = None - self.created_date = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - self.latest_operation_result = None - - -class LabAccount(Resource): - """Represents a lab account. - - 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: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :ivar size_configuration: Represents the size configuration under the lab account. - :vartype size_configuration: ~azure.mgmt.labservices.models.SizeConfigurationProperties - :param enabled_region_selection: Represents if region selection is enabled. - :type enabled_region_selection: bool - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult + :param location: Required. The geo-location where the resource lives. + :type location: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'size_configuration': {'readonly': True}, - 'latest_operation_result': {'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}'}, - 'size_configuration': {'key': 'properties.sizeConfiguration', 'type': 'SizeConfigurationProperties'}, - 'enabled_region_selection': {'key': 'properties.enabledRegionSelection', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'location': {'key': 'location', 'type': 'str'}, } def __init__( self, **kwargs ): - super(LabAccount, self).__init__(**kwargs) - self.size_configuration = None - self.enabled_region_selection = kwargs.get('enabled_region_selection', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - self.latest_operation_result = None + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] -class LabAccountFragment(Resource): - """Represents a lab account. +class Lab(TrackedResource): + """The lab resource. 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param enabled_region_selection: Represents if region selection is enabled. - :type enabled_region_selection: bool - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the lab. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param auto_shutdown_profile: The resource auto shutdown configuration for the lab. This + controls whether actions are taken on resources that are sitting idle. + :type auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param connection_profile: The connection profile for the lab. This controls settings such as + web access to lab resources or whether RDP or SSH ports are open. + :type connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param virtual_machine_profile: The profile used for creating lab virtual machines. + :type virtual_machine_profile: ~azure.mgmt.labservices.models.VirtualMachineProfile + :param security_profile: The lab security profile. + :type security_profile: ~azure.mgmt.labservices.models.SecurityProfile + :param roster_profile: The lab user list management profile. + :type roster_profile: ~azure.mgmt.labservices.models.RosterProfile + :param lab_plan_id: The ID of the lab plan. Used during resource creation to provide defaults + and acts as a permission container when creating a lab via labs.azure.com. Setting a labPlanId + on an existing lab provides organization.. + :type lab_plan_id: str + :param title: The title of the lab. + :type title: str + :param description: The description of the lab. + :type description: str + :ivar provisioning_state: Current provisioning state of the lab. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :param network_profile: The network profile for the lab, typically applied via a lab plan. This + profile cannot be modified once a lab has been created. + :type network_profile: ~azure.mgmt.labservices.models.LabNetworkProfile + :ivar state: The lab state. Possible values include: "Draft", "Publishing", "Scaling", + "Syncing", "Published". + :vartype state: str or ~azure.mgmt.labservices.models.LabState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'lab_plan_id': {'max_length': 2000, 'min_length': 3}, + 'title': {'max_length': 120, 'min_length': 1}, + 'provisioning_state': {'readonly': True}, + 'state': {'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}'}, - 'enabled_region_selection': {'key': 'properties.enabledRegionSelection', 'type': 'bool'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'auto_shutdown_profile': {'key': 'properties.autoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'connection_profile': {'key': 'properties.connectionProfile', 'type': 'ConnectionProfile'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'roster_profile': {'key': 'properties.rosterProfile', 'type': 'RosterProfile'}, + 'lab_plan_id': {'key': 'properties.labPlanId', 'type': 'str'}, + 'title': {'key': 'properties.title', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'LabNetworkProfile'}, + 'state': {'key': 'properties.state', 'type': 'str'}, } def __init__( self, **kwargs ): - super(LabAccountFragment, self).__init__(**kwargs) - self.enabled_region_selection = kwargs.get('enabled_region_selection', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - - -class LabCreationParameters(msrest.serialization.Model): - """Settings related to creating a lab. - - :param max_users_in_lab: Maximum number of users allowed in the lab. - :type max_users_in_lab: int - """ - - _attribute_map = { - 'max_users_in_lab': {'key': 'maxUsersInLab', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(LabCreationParameters, self).__init__(**kwargs) - self.max_users_in_lab = kwargs.get('max_users_in_lab', None) - + super(Lab, self).__init__(**kwargs) + self.system_data = None + self.auto_shutdown_profile = kwargs.get('auto_shutdown_profile', None) + self.connection_profile = kwargs.get('connection_profile', None) + self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) + self.security_profile = kwargs.get('security_profile', None) + self.roster_profile = kwargs.get('roster_profile', None) + self.lab_plan_id = kwargs.get('lab_plan_id', None) + self.title = kwargs.get('title', None) + self.description = kwargs.get('description', None) + self.provisioning_state = None + self.network_profile = kwargs.get('network_profile', None) + self.state = None -class LabDetails(msrest.serialization.Model): - """This represents the details about a lab that the User is in, and its state. - Variables are only populated by the server, and will be ignored when sending a request. +class LabNetworkProfile(msrest.serialization.Model): + """Profile for how to handle networking for Labs. - :param name: Name of the lab. - :type name: str - :param provisioning_state: The provisioning state of the lab. - :type provisioning_state: str - :param id: The Id of the lab. - :type id: str - :ivar usage_quota: The maximum duration a user can use a VM in this lab. - :vartype usage_quota: ~datetime.timedelta + :param subnet_id: The external subnet resource id. + :type subnet_id: str + :param load_balancer_id: The external load balancer resource id. + :type load_balancer_id: str + :param public_ip_id: The external public IP resource id. + :type public_ip_id: str """ _validation = { - 'usage_quota': {'readonly': True}, + 'subnet_id': {'max_length': 2000, 'min_length': 3}, + 'load_balancer_id': {'max_length': 2000, 'min_length': 3}, + 'public_ip_id': {'max_length': 2000, 'min_length': 3}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'usage_quota': {'key': 'usageQuota', 'type': 'duration'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'load_balancer_id': {'key': 'loadBalancerId', 'type': 'str'}, + 'public_ip_id': {'key': 'publicIpId', 'type': 'str'}, } def __init__( self, **kwargs ): - super(LabDetails, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.id = kwargs.get('id', None) - self.usage_quota = None + super(LabNetworkProfile, self).__init__(**kwargs) + self.subnet_id = kwargs.get('subnet_id', None) + self.load_balancer_id = kwargs.get('load_balancer_id', None) + self.public_ip_id = kwargs.get('public_ip_id', None) -class LabFragment(Resource): - """Represents a lab. +class LabPlan(TrackedResource): + """Lab Plans act as a permission container for creating labs via labs.azure.com. Additionally, they can provide a set of default configurations that will apply at the time of creating a lab, but these defaults can still be overwritten. 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param max_users_in_lab: Maximum number of users allowed in the lab. - :type max_users_in_lab: int - :param usage_quota: Maximum duration a user can use an environment for in the lab. - :type usage_quota: ~datetime.timedelta - :param user_access_mode: Lab user access mode (open to all vs. restricted to those listed on - the lab). Possible values include: "Restricted", "Open". - :type user_access_mode: str or ~azure.mgmt.labservices.models.LabUserAccessMode - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the lab plan. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param default_connection_profile: The default lab connection profile. This can be changed on a + lab resource and only provides a default profile. + :type default_connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param default_auto_shutdown_profile: The default lab shutdown profile. This can be changed on + a lab resource and only provides a default profile. + :type default_auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param default_network_profile: The lab plan network profile. To enforce lab network policies + they must be defined here and cannot be changed when there are existing labs associated with + this lab plan. + :type default_network_profile: ~azure.mgmt.labservices.models.LabPlanNetworkProfile + :param allowed_regions: The allowed regions for the lab creator to use when creating labs using + this lab plan. + :type allowed_regions: list[str] + :param shared_gallery_id: Resource ID of the Shared Image Gallery attached to this lab plan. + When saving a lab template virtual machine image it will be persisted in this gallery. Shared + images from the gallery can be made available to use when creating new labs. + :type shared_gallery_id: str + :param support_info: Support contact information and instructions for users of the lab plan. + This information is displayed to lab owners and virtual machine users for all labs in the lab + plan. + :type support_info: ~azure.mgmt.labservices.models.SupportInfo + :param linked_lms_instance: Base Url of the lms instance this lab plan can link lab rosters + against. + :type linked_lms_instance: str + :ivar provisioning_state: Current provisioning state of the lab plan. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'shared_gallery_id': {'max_length': 2000, 'min_length': 3}, + 'linked_lms_instance': {'max_length': 2000, 'min_length': 3}, + 'provisioning_state': {'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}'}, - 'max_users_in_lab': {'key': 'properties.maxUsersInLab', 'type': 'int'}, - 'usage_quota': {'key': 'properties.usageQuota', 'type': 'duration'}, - 'user_access_mode': {'key': 'properties.userAccessMode', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'default_connection_profile': {'key': 'properties.defaultConnectionProfile', 'type': 'ConnectionProfile'}, + 'default_auto_shutdown_profile': {'key': 'properties.defaultAutoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'default_network_profile': {'key': 'properties.defaultNetworkProfile', 'type': 'LabPlanNetworkProfile'}, + 'allowed_regions': {'key': 'properties.allowedRegions', 'type': '[str]'}, + 'shared_gallery_id': {'key': 'properties.sharedGalleryId', 'type': 'str'}, + 'support_info': {'key': 'properties.supportInfo', 'type': 'SupportInfo'}, + 'linked_lms_instance': {'key': 'properties.linkedLmsInstance', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, } def __init__( self, **kwargs ): - super(LabFragment, self).__init__(**kwargs) - self.max_users_in_lab = kwargs.get('max_users_in_lab', None) - self.usage_quota = kwargs.get('usage_quota', None) - self.user_access_mode = kwargs.get('user_access_mode', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - + super(LabPlan, self).__init__(**kwargs) + self.system_data = None + self.default_connection_profile = kwargs.get('default_connection_profile', None) + self.default_auto_shutdown_profile = kwargs.get('default_auto_shutdown_profile', None) + self.default_network_profile = kwargs.get('default_network_profile', None) + self.allowed_regions = kwargs.get('allowed_regions', None) + self.shared_gallery_id = kwargs.get('shared_gallery_id', None) + self.support_info = kwargs.get('support_info', None) + self.linked_lms_instance = kwargs.get('linked_lms_instance', None) + self.provisioning_state = None -class LatestOperationResult(msrest.serialization.Model): - """Details of the status of an operation. - Variables are only populated by the server, and will be ignored when sending a request. +class LabPlanNetworkProfile(msrest.serialization.Model): + """Profile for how to handle networking for Lab Plans. - :ivar status: The current status of the operation. - :vartype status: str - :ivar error_code: Error code on failure. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar request_uri: Request URI of the operation. - :vartype request_uri: str - :ivar http_method: The HttpMethod - PUT/POST/DELETE for the operation. - :vartype http_method: str - :ivar operation_url: The URL to use to check long-running operation status. - :vartype operation_url: str + :param subnet_id: The external subnet resource id. + :type subnet_id: str """ _validation = { - 'status': {'readonly': True}, - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'request_uri': {'readonly': True}, - 'http_method': {'readonly': True}, - 'operation_url': {'readonly': True}, + 'subnet_id': {'max_length': 2000, 'min_length': 3}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'http_method': {'key': 'httpMethod', 'type': 'str'}, - 'operation_url': {'key': 'operationUrl', 'type': 'str'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, } def __init__( self, **kwargs ): - super(LatestOperationResult, self).__init__(**kwargs) - self.status = None - self.error_code = None - self.error_message = None - self.request_uri = None - self.http_method = None - self.operation_url = None + super(LabPlanNetworkProfile, self).__init__(**kwargs) + self.subnet_id = kwargs.get('subnet_id', None) -class ListEnvironmentsPayload(msrest.serialization.Model): - """Represents the payload to list environments owned by a user. +class LabPlanUpdateProperties(msrest.serialization.Model): + """Lab plan resource properties for updates. - :param lab_id: The resource Id of the lab. - :type lab_id: str + :param default_connection_profile: The default lab connection profile. This can be changed on a + lab resource and only provides a default profile. + :type default_connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param default_auto_shutdown_profile: The default lab shutdown profile. This can be changed on + a lab resource and only provides a default profile. + :type default_auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param default_network_profile: The lab plan network profile. To enforce lab network policies + they must be defined here and cannot be changed when there are existing labs associated with + this lab plan. + :type default_network_profile: ~azure.mgmt.labservices.models.LabPlanNetworkProfile + :param allowed_regions: The allowed regions for the lab creator to use when creating labs using + this lab plan. + :type allowed_regions: list[str] + :param shared_gallery_id: Resource ID of the Shared Image Gallery attached to this lab plan. + When saving a lab template virtual machine image it will be persisted in this gallery. Shared + images from the gallery can be made available to use when creating new labs. + :type shared_gallery_id: str + :param support_info: Support contact information and instructions for users of the lab plan. + This information is displayed to lab owners and virtual machine users for all labs in the lab + plan. + :type support_info: ~azure.mgmt.labservices.models.SupportInfo + :param linked_lms_instance: Base Url of the lms instance this lab plan can link lab rosters + against. + :type linked_lms_instance: str """ + _validation = { + 'shared_gallery_id': {'max_length': 2000, 'min_length': 3}, + 'linked_lms_instance': {'max_length': 2000, 'min_length': 3}, + } + _attribute_map = { - 'lab_id': {'key': 'labId', 'type': 'str'}, + 'default_connection_profile': {'key': 'defaultConnectionProfile', 'type': 'ConnectionProfile'}, + 'default_auto_shutdown_profile': {'key': 'defaultAutoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'default_network_profile': {'key': 'defaultNetworkProfile', 'type': 'LabPlanNetworkProfile'}, + 'allowed_regions': {'key': 'allowedRegions', 'type': '[str]'}, + 'shared_gallery_id': {'key': 'sharedGalleryId', 'type': 'str'}, + 'support_info': {'key': 'supportInfo', 'type': 'SupportInfo'}, + 'linked_lms_instance': {'key': 'linkedLmsInstance', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ListEnvironmentsPayload, self).__init__(**kwargs) - self.lab_id = kwargs.get('lab_id', None) + super(LabPlanUpdateProperties, self).__init__(**kwargs) + self.default_connection_profile = kwargs.get('default_connection_profile', None) + self.default_auto_shutdown_profile = kwargs.get('default_auto_shutdown_profile', None) + self.default_network_profile = kwargs.get('default_network_profile', None) + self.allowed_regions = kwargs.get('allowed_regions', None) + self.shared_gallery_id = kwargs.get('shared_gallery_id', None) + self.support_info = kwargs.get('support_info', None) + self.linked_lms_instance = kwargs.get('linked_lms_instance', None) + +class LabPlanProperties(LabPlanUpdateProperties): + """Lab plan resource properties. -class ListEnvironmentsResponse(msrest.serialization.Model): - """Represents the list of environments owned by a user. + Variables are only populated by the server, and will be ignored when sending a request. - :param environments: List of all the environments. - :type environments: list[~azure.mgmt.labservices.models.EnvironmentDetails] + :param default_connection_profile: The default lab connection profile. This can be changed on a + lab resource and only provides a default profile. + :type default_connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param default_auto_shutdown_profile: The default lab shutdown profile. This can be changed on + a lab resource and only provides a default profile. + :type default_auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param default_network_profile: The lab plan network profile. To enforce lab network policies + they must be defined here and cannot be changed when there are existing labs associated with + this lab plan. + :type default_network_profile: ~azure.mgmt.labservices.models.LabPlanNetworkProfile + :param allowed_regions: The allowed regions for the lab creator to use when creating labs using + this lab plan. + :type allowed_regions: list[str] + :param shared_gallery_id: Resource ID of the Shared Image Gallery attached to this lab plan. + When saving a lab template virtual machine image it will be persisted in this gallery. Shared + images from the gallery can be made available to use when creating new labs. + :type shared_gallery_id: str + :param support_info: Support contact information and instructions for users of the lab plan. + This information is displayed to lab owners and virtual machine users for all labs in the lab + plan. + :type support_info: ~azure.mgmt.labservices.models.SupportInfo + :param linked_lms_instance: Base Url of the lms instance this lab plan can link lab rosters + against. + :type linked_lms_instance: str + :ivar provisioning_state: Current provisioning state of the lab plan. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState """ + _validation = { + 'shared_gallery_id': {'max_length': 2000, 'min_length': 3}, + 'linked_lms_instance': {'max_length': 2000, 'min_length': 3}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'environments': {'key': 'environments', 'type': '[EnvironmentDetails]'}, + 'default_connection_profile': {'key': 'defaultConnectionProfile', 'type': 'ConnectionProfile'}, + 'default_auto_shutdown_profile': {'key': 'defaultAutoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'default_network_profile': {'key': 'defaultNetworkProfile', 'type': 'LabPlanNetworkProfile'}, + 'allowed_regions': {'key': 'allowedRegions', 'type': '[str]'}, + 'shared_gallery_id': {'key': 'sharedGalleryId', 'type': 'str'}, + 'support_info': {'key': 'supportInfo', 'type': 'SupportInfo'}, + 'linked_lms_instance': {'key': 'linkedLmsInstance', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ListEnvironmentsResponse, self).__init__(**kwargs) - self.environments = kwargs.get('environments', None) + super(LabPlanProperties, self).__init__(**kwargs) + self.provisioning_state = None -class ListLabsResponse(msrest.serialization.Model): - """Lists the labs owned by a user. +class TrackedResourceUpdate(msrest.serialization.Model): + """Base tracked resource type for all PATCH updates. - :param labs: List of all the labs. - :type labs: list[~azure.mgmt.labservices.models.LabDetails] + :param tags: A set of tags. Resource tags. + :type tags: list[str] """ _attribute_map = { - 'labs': {'key': 'labs', 'type': '[LabDetails]'}, + 'tags': {'key': 'tags', 'type': '[str]'}, } def __init__( self, **kwargs ): - super(ListLabsResponse, self).__init__(**kwargs) - self.labs = kwargs.get('labs', None) - - -class NetworkInterface(msrest.serialization.Model): - """Network details of the environment. + super(TrackedResourceUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) - Variables are only populated by the server, and will be ignored when sending a request. - :ivar private_ip_address: PrivateIp address of the Compute VM. - :vartype private_ip_address: str - :ivar ssh_authority: Connection information for Linux. - :vartype ssh_authority: str - :ivar rdp_authority: Connection information for Windows. - :vartype rdp_authority: str - :ivar username: Username of the VM. - :vartype username: str +class LabPlanUpdate(TrackedResourceUpdate): + """Contains lab configuration and default settings. This variant is used for PATCH. + + :param tags: A set of tags. Resource tags. + :type tags: list[str] + :param default_connection_profile: The default lab connection profile. This can be changed on a + lab resource and only provides a default profile. + :type default_connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param default_auto_shutdown_profile: The default lab shutdown profile. This can be changed on + a lab resource and only provides a default profile. + :type default_auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param default_network_profile: The lab plan network profile. To enforce lab network policies + they must be defined here and cannot be changed when there are existing labs associated with + this lab plan. + :type default_network_profile: ~azure.mgmt.labservices.models.LabPlanNetworkProfile + :param allowed_regions: The allowed regions for the lab creator to use when creating labs using + this lab plan. + :type allowed_regions: list[str] + :param shared_gallery_id: Resource ID of the Shared Image Gallery attached to this lab plan. + When saving a lab template virtual machine image it will be persisted in this gallery. Shared + images from the gallery can be made available to use when creating new labs. + :type shared_gallery_id: str + :param support_info: Support contact information and instructions for users of the lab plan. + This information is displayed to lab owners and virtual machine users for all labs in the lab + plan. + :type support_info: ~azure.mgmt.labservices.models.SupportInfo + :param linked_lms_instance: Base Url of the lms instance this lab plan can link lab rosters + against. + :type linked_lms_instance: str """ _validation = { - 'private_ip_address': {'readonly': True}, - 'ssh_authority': {'readonly': True}, - 'rdp_authority': {'readonly': True}, - 'username': {'readonly': True}, + 'shared_gallery_id': {'max_length': 2000, 'min_length': 3}, + 'linked_lms_instance': {'max_length': 2000, 'min_length': 3}, } _attribute_map = { - 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, - 'ssh_authority': {'key': 'sshAuthority', 'type': 'str'}, - 'rdp_authority': {'key': 'rdpAuthority', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'default_connection_profile': {'key': 'properties.defaultConnectionProfile', 'type': 'ConnectionProfile'}, + 'default_auto_shutdown_profile': {'key': 'properties.defaultAutoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'default_network_profile': {'key': 'properties.defaultNetworkProfile', 'type': 'LabPlanNetworkProfile'}, + 'allowed_regions': {'key': 'properties.allowedRegions', 'type': '[str]'}, + 'shared_gallery_id': {'key': 'properties.sharedGalleryId', 'type': 'str'}, + 'support_info': {'key': 'properties.supportInfo', 'type': 'SupportInfo'}, + 'linked_lms_instance': {'key': 'properties.linkedLmsInstance', 'type': 'str'}, } def __init__( self, **kwargs ): - super(NetworkInterface, self).__init__(**kwargs) - self.private_ip_address = None - self.ssh_authority = None - self.rdp_authority = None - self.username = None + super(LabPlanUpdate, self).__init__(**kwargs) + self.default_connection_profile = kwargs.get('default_connection_profile', None) + self.default_auto_shutdown_profile = kwargs.get('default_auto_shutdown_profile', None) + self.default_network_profile = kwargs.get('default_network_profile', None) + self.allowed_regions = kwargs.get('allowed_regions', None) + self.shared_gallery_id = kwargs.get('shared_gallery_id', None) + self.support_info = kwargs.get('support_info', None) + self.linked_lms_instance = kwargs.get('linked_lms_instance', None) -class OperationBatchStatusPayload(msrest.serialization.Model): - """Payload to get the status of an operation. +class LabUpdateProperties(msrest.serialization.Model): + """Properties of a lab resource used for updates. - All required parameters must be populated in order to send to Azure. - - :param urls: Required. The operation url of long running operation. - :type urls: list[str] + :param auto_shutdown_profile: The resource auto shutdown configuration for the lab. This + controls whether actions are taken on resources that are sitting idle. + :type auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param connection_profile: The connection profile for the lab. This controls settings such as + web access to lab resources or whether RDP or SSH ports are open. + :type connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param virtual_machine_profile: The profile used for creating lab virtual machines. + :type virtual_machine_profile: ~azure.mgmt.labservices.models.VirtualMachineProfile + :param security_profile: The lab security profile. + :type security_profile: ~azure.mgmt.labservices.models.SecurityProfile + :param roster_profile: The lab user list management profile. + :type roster_profile: ~azure.mgmt.labservices.models.RosterProfile + :param lab_plan_id: The ID of the lab plan. Used during resource creation to provide defaults + and acts as a permission container when creating a lab via labs.azure.com. Setting a labPlanId + on an existing lab provides organization.. + :type lab_plan_id: str + :param title: The title of the lab. + :type title: str + :param description: The description of the lab. + :type description: str """ _validation = { - 'urls': {'required': True}, + 'lab_plan_id': {'max_length': 2000, 'min_length': 3}, + 'title': {'max_length': 120, 'min_length': 1}, } _attribute_map = { - 'urls': {'key': 'urls', 'type': '[str]'}, + 'auto_shutdown_profile': {'key': 'autoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'connection_profile': {'key': 'connectionProfile', 'type': 'ConnectionProfile'}, + 'virtual_machine_profile': {'key': 'virtualMachineProfile', 'type': 'VirtualMachineProfile'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'roster_profile': {'key': 'rosterProfile', 'type': 'RosterProfile'}, + 'lab_plan_id': {'key': 'labPlanId', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationBatchStatusPayload, self).__init__(**kwargs) - self.urls = kwargs['urls'] + super(LabUpdateProperties, self).__init__(**kwargs) + self.auto_shutdown_profile = kwargs.get('auto_shutdown_profile', None) + self.connection_profile = kwargs.get('connection_profile', None) + self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) + self.security_profile = kwargs.get('security_profile', None) + self.roster_profile = kwargs.get('roster_profile', None) + self.lab_plan_id = kwargs.get('lab_plan_id', None) + self.title = kwargs.get('title', None) + self.description = kwargs.get('description', None) -class OperationBatchStatusResponse(msrest.serialization.Model): - """Status Details of the long running operation for an environment. +class LabProperties(LabUpdateProperties): + """Properties of a lab resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar items: Gets a collection of items that contain the operation url and status. - :vartype items: list[~azure.mgmt.labservices.models.OperationBatchStatusResponseItem] + :param auto_shutdown_profile: The resource auto shutdown configuration for the lab. This + controls whether actions are taken on resources that are sitting idle. + :type auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param connection_profile: The connection profile for the lab. This controls settings such as + web access to lab resources or whether RDP or SSH ports are open. + :type connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param virtual_machine_profile: The profile used for creating lab virtual machines. + :type virtual_machine_profile: ~azure.mgmt.labservices.models.VirtualMachineProfile + :param security_profile: The lab security profile. + :type security_profile: ~azure.mgmt.labservices.models.SecurityProfile + :param roster_profile: The lab user list management profile. + :type roster_profile: ~azure.mgmt.labservices.models.RosterProfile + :param lab_plan_id: The ID of the lab plan. Used during resource creation to provide defaults + and acts as a permission container when creating a lab via labs.azure.com. Setting a labPlanId + on an existing lab provides organization.. + :type lab_plan_id: str + :param title: The title of the lab. + :type title: str + :param description: The description of the lab. + :type description: str + :ivar provisioning_state: Current provisioning state of the lab. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :param network_profile: The network profile for the lab, typically applied via a lab plan. This + profile cannot be modified once a lab has been created. + :type network_profile: ~azure.mgmt.labservices.models.LabNetworkProfile + :ivar state: The lab state. Possible values include: "Draft", "Publishing", "Scaling", + "Syncing", "Published". + :vartype state: str or ~azure.mgmt.labservices.models.LabState """ _validation = { - 'items': {'readonly': True}, + 'lab_plan_id': {'max_length': 2000, 'min_length': 3}, + 'title': {'max_length': 120, 'min_length': 1}, + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, } _attribute_map = { - 'items': {'key': 'items', 'type': '[OperationBatchStatusResponseItem]'}, + 'auto_shutdown_profile': {'key': 'autoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'connection_profile': {'key': 'connectionProfile', 'type': 'ConnectionProfile'}, + 'virtual_machine_profile': {'key': 'virtualMachineProfile', 'type': 'VirtualMachineProfile'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'roster_profile': {'key': 'rosterProfile', 'type': 'RosterProfile'}, + 'lab_plan_id': {'key': 'labPlanId', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_profile': {'key': 'networkProfile', 'type': 'LabNetworkProfile'}, + 'state': {'key': 'state', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationBatchStatusResponse, self).__init__(**kwargs) - self.items = None - - -class OperationBatchStatusResponseItem(msrest.serialization.Model): - """Represents the status of an operation that used the batch API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation_url: status of the long running operation for an environment. - :vartype operation_url: str - :ivar status: status of the long running operation for an environment. - :vartype status: str + super(LabProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.network_profile = kwargs.get('network_profile', None) + self.state = None + + +class LabUpdate(TrackedResourceUpdate): + """The lab resource for updates. + + :param tags: A set of tags. Resource tags. + :type tags: list[str] + :param auto_shutdown_profile: The resource auto shutdown configuration for the lab. This + controls whether actions are taken on resources that are sitting idle. + :type auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param connection_profile: The connection profile for the lab. This controls settings such as + web access to lab resources or whether RDP or SSH ports are open. + :type connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param virtual_machine_profile: The profile used for creating lab virtual machines. + :type virtual_machine_profile: ~azure.mgmt.labservices.models.VirtualMachineProfile + :param security_profile: The lab security profile. + :type security_profile: ~azure.mgmt.labservices.models.SecurityProfile + :param roster_profile: The lab user list management profile. + :type roster_profile: ~azure.mgmt.labservices.models.RosterProfile + :param lab_plan_id: The ID of the lab plan. Used during resource creation to provide defaults + and acts as a permission container when creating a lab via labs.azure.com. Setting a labPlanId + on an existing lab provides organization.. + :type lab_plan_id: str + :param title: The title of the lab. + :type title: str + :param description: The description of the lab. + :type description: str """ _validation = { - 'operation_url': {'readonly': True}, - 'status': {'readonly': True}, + 'lab_plan_id': {'max_length': 2000, 'min_length': 3}, + 'title': {'max_length': 120, 'min_length': 1}, } _attribute_map = { - 'operation_url': {'key': 'operationUrl', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'auto_shutdown_profile': {'key': 'properties.autoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'connection_profile': {'key': 'properties.connectionProfile', 'type': 'ConnectionProfile'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'roster_profile': {'key': 'properties.rosterProfile', 'type': 'RosterProfile'}, + 'lab_plan_id': {'key': 'properties.labPlanId', 'type': 'str'}, + 'title': {'key': 'properties.title', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationBatchStatusResponseItem, self).__init__(**kwargs) - self.operation_url = None - self.status = None + super(LabUpdate, self).__init__(**kwargs) + self.auto_shutdown_profile = kwargs.get('auto_shutdown_profile', None) + self.connection_profile = kwargs.get('connection_profile', None) + self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) + self.security_profile = kwargs.get('security_profile', None) + self.roster_profile = kwargs.get('roster_profile', None) + self.lab_plan_id = kwargs.get('lab_plan_id', None) + self.title = kwargs.get('title', None) + self.description = kwargs.get('description', None) + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. -class OperationError(msrest.serialization.Model): - """Error details for the operation in case of a failure. + Variables are only populated by the server, and will be ignored when sending a request. - :param code: The error code of the operation error. - :type code: str - :param message: The error message of the operation error. - :type message: str + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. + :type display: ~azure.mgmt.labservices.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.labservices.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.labservices.models.ActionType """ - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, } - def __init__( - self, - **kwargs - ): - super(OperationError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class OperationMetadata(msrest.serialization.Model): - """The REST API operation supported by ManagedLab ResourceProvider. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operations. - :type display: ~azure.mgmt.labservices.models.OperationMetadataDisplay - """ - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationMetadataDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationMetadata, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None self.display = kwargs.get('display', None) + self.origin = None + self.action_type = None -class OperationMetadataDisplay(msrest.serialization.Model): - """The object that describes the operations. +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param operation: Operation type: read, write, delete, listKeys/action, etc. - :type operation: str - :param description: Friendly name of the operation. - :type description: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, @@ -1537,131 +1370,116 @@ def __init__( self, **kwargs ): - super(OperationMetadataDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationResult(msrest.serialization.Model): - """An Operation Result. - - :param status: The operation status. - :type status: str - :param error: Error details for the operation in case of a failure. - :type error: ~azure.mgmt.labservices.models.OperationError - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'OperationError'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResult, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.error = kwargs.get('error', None) + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class OperationStatusPayload(msrest.serialization.Model): - """Payload to get the status of an operation. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param operation_url: Required. The operation url of long running operation. - :type operation_url: str + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.labservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ _validation = { - 'operation_url': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'operation_url': {'key': 'operationUrl', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationStatusPayload, self).__init__(**kwargs) - self.operation_url = kwargs['operation_url'] + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class OperationStatusResponse(msrest.serialization.Model): - """Status Details of the long running operation for an environment. +class OperationResult(msrest.serialization.Model): + """A long running operation result. Variables are only populated by the server, and will be ignored when sending a request. - :ivar status: status of the long running operation for an environment. - :vartype status: str + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param status: Required. The operation status. Possible values include: "NotStarted", + "InProgress", "Succeeded", "Failed", "Canceled". + :type status: str or ~azure.mgmt.labservices.models.OperationStatus + :param start_time: Start time. + :type start_time: ~datetime.datetime + :param end_time: End time. + :type end_time: ~datetime.datetime + :param percent_complete: Percent completion. + :type percent_complete: float + :param error: The error for a failure if the operation failed. + :type error: ~azure.mgmt.labservices.models.ErrorDetail """ _validation = { - 'status': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'status': {'required': True}, } - def __init__( - self, - **kwargs - ): - super(OperationStatusResponse, self).__init__(**kwargs) - self.status = None - - -class PersonalPreferencesOperationsPayload(msrest.serialization.Model): - """Represents payload for any Environment operations like get, start, stop, connect. - - :param lab_account_resource_id: Resource Id of the lab account. - :type lab_account_resource_id: str - :param add_remove: Enum indicating if user is adding or removing a favorite lab. Possible - values include: "Add", "Remove". - :type add_remove: str or ~azure.mgmt.labservices.models.AddRemove - :param lab_resource_id: Resource Id of the lab to add/remove from the favorites list. - :type lab_resource_id: str - """ - _attribute_map = { - 'lab_account_resource_id': {'key': 'labAccountResourceId', 'type': 'str'}, - 'add_remove': {'key': 'addRemove', 'type': 'str'}, - 'lab_resource_id': {'key': 'labResourceId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, **kwargs ): - super(PersonalPreferencesOperationsPayload, self).__init__(**kwargs) - self.lab_account_resource_id = kwargs.get('lab_account_resource_id', None) - self.add_remove = kwargs.get('add_remove', None) - self.lab_resource_id = kwargs.get('lab_resource_id', None) + super(OperationResult, self).__init__(**kwargs) + self.id = None + self.name = None + self.status = kwargs['status'] + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.percent_complete = kwargs.get('percent_complete', None) + self.error = kwargs.get('error', None) -class ProviderOperationResult(msrest.serialization.Model): - """Result of the request to list REST API operations. +class PagedImages(msrest.serialization.Model): + """Paged list of Lab services virtual machine images. Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by the resource provider. - :type value: list[~azure.mgmt.labservices.models.OperationMetadata] - :ivar next_link: URL to get the next set of operation list results if there are any. + :ivar value: The array page of virtual machine images. + :vartype value: list[~azure.mgmt.labservices.models.Image] + :ivar next_link: The link to get the next page of image results. :vartype next_link: str """ _validation = { + 'value': {'readonly': True}, 'next_link': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationMetadata]'}, + 'value': {'key': 'value', 'type': '[Image]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } @@ -1669,187 +1487,221 @@ def __init__( self, **kwargs ): - super(ProviderOperationResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + super(PagedImages, self).__init__(**kwargs) + self.value = None self.next_link = None -class PublishPayload(msrest.serialization.Model): - """Payload for Publish operation on EnvironmentSetting. +class PagedLabPlans(msrest.serialization.Model): + """Paged list of lab plans. + + Variables are only populated by the server, and will be ignored when sending a request. - :param use_existing_image: Whether to use existing VM custom image when publishing. - :type use_existing_image: bool + :ivar value: The array page of lab plans. + :vartype value: list[~azure.mgmt.labservices.models.LabPlan] + :ivar next_link: The link to get the next page of lab plan results. + :vartype next_link: str """ + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'use_existing_image': {'key': 'useExistingImage', 'type': 'bool'}, + 'value': {'key': 'value', 'type': '[LabPlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(PublishPayload, self).__init__(**kwargs) - self.use_existing_image = kwargs.get('use_existing_image', None) + super(PagedLabPlans, self).__init__(**kwargs) + self.value = None + self.next_link = None -class ReferenceVm(msrest.serialization.Model): - """Details of a Reference Vm. +class PagedLabs(msrest.serialization.Model): + """Paged list of labs. 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. - - :param user_name: Required. The username of the virtual machine. - :type user_name: str - :param password: The password of the virtual machine. This will be set to null in GET resource - API. - :type password: str - :ivar vm_state_details: The state details for the reference virtual machine. - :vartype vm_state_details: ~azure.mgmt.labservices.models.VmStateDetails - :ivar vm_resource_id: VM resource Id for the environment. - :vartype vm_resource_id: str + :ivar value: The array page of lab results. + :vartype value: list[~azure.mgmt.labservices.models.Lab] + :ivar next_link: The link to get the next page of image results. + :vartype next_link: str """ _validation = { - 'user_name': {'required': True}, - 'vm_state_details': {'readonly': True}, - 'vm_resource_id': {'readonly': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'vm_state_details': {'key': 'vmStateDetails', 'type': 'VmStateDetails'}, - 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Lab]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ReferenceVm, self).__init__(**kwargs) - self.user_name = kwargs['user_name'] - self.password = kwargs.get('password', None) - self.vm_state_details = None - self.vm_resource_id = None + super(PagedLabs, self).__init__(**kwargs) + self.value = None + self.next_link = None -class ReferenceVmCreationParameters(msrest.serialization.Model): - """Creation parameters for Reference Vm. +class PagedSchedules(msrest.serialization.Model): + """Paged list of schedules. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param user_name: Required. The username of the virtual machine. - :type user_name: str - :param password: Required. The password of the virtual machine. - :type password: str + :ivar value: The array page of schedule results. + :vartype value: list[~azure.mgmt.labservices.models.Schedule] + :ivar next_link: The link to get the next page of schedule results. + :vartype next_link: str """ _validation = { - 'user_name': {'required': True}, - 'password': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Schedule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ReferenceVmCreationParameters, self).__init__(**kwargs) - self.user_name = kwargs['user_name'] - self.password = kwargs['password'] + super(PagedSchedules, self).__init__(**kwargs) + self.value = None + self.next_link = None -class ReferenceVmFragment(msrest.serialization.Model): - """Details of a Reference Vm. +class PagedUsers(msrest.serialization.Model): + """Paged list of users. - :param user_name: The username of the virtual machine. - :type user_name: str - :param password: The password of the virtual machine. This will be set to null in GET resource - API. - :type password: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The array page of user results. + :vartype value: list[~azure.mgmt.labservices.models.User] + :ivar next_link: The link to get the next page of image results. + :vartype next_link: str """ + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[User]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ReferenceVmFragment, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.password = kwargs.get('password', None) + super(PagedUsers, self).__init__(**kwargs) + self.value = None + self.next_link = None + +class PagedVirtualMachines(msrest.serialization.Model): + """Paged list of lab services virtual machines. -class RegionalAvailability(msrest.serialization.Model): - """The availability information of sizes across regions. + Variables are only populated by the server, and will be ignored when sending a request. - :param region: Corresponding region. - :type region: str - :param size_availabilities: List of all the size information for the region. - :type size_availabilities: list[~azure.mgmt.labservices.models.SizeAvailability] + :ivar value: The array page of virtual machine results. + :vartype value: list[~azure.mgmt.labservices.models.VirtualMachine] + :ivar next_link: The link to get the next page of virtual machine results. + :vartype next_link: str """ + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'size_availabilities': {'key': 'sizeAvailabilities', 'type': '[SizeAvailability]'}, + 'value': {'key': 'value', 'type': '[VirtualMachine]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(RegionalAvailability, self).__init__(**kwargs) - self.region = kwargs.get('region', None) - self.size_availabilities = kwargs.get('size_availabilities', None) + super(PagedVirtualMachines, self).__init__(**kwargs) + self.value = None + self.next_link = None -class RegisterPayload(msrest.serialization.Model): - """Represents payload for Register action. +class RecurrencePattern(msrest.serialization.Model): + """Recurrence pattern of a lab schedule. + + All required parameters must be populated in order to send to Azure. - :param registration_code: The registration code of the lab. - :type registration_code: str + :param frequency: Required. The frequency of the recurrence. Possible values include: "Daily", + "Weekly". + :type frequency: str or ~azure.mgmt.labservices.models.RecurrenceFrequency + :param week_days: The week days the schedule runs. Used for when the Frequency is set to + Weekly. + :type week_days: list[str or ~azure.mgmt.labservices.models.WeekDay] + :param interval: The interval to invoke the schedule on. For example, interval = 2 and + RecurrenceFrequency.Daily will run every 2 days. When no interval is supplied, an interval of 1 + is used. + :type interval: int + :param expiration_date: Required. When the recurrence will expire. This date is inclusive. + :type expiration_date: ~datetime.date """ + _validation = { + 'frequency': {'required': True}, + 'interval': {'maximum': 365, 'minimum': 1}, + 'expiration_date': {'required': True}, + } + _attribute_map = { - 'registration_code': {'key': 'registrationCode', 'type': 'str'}, + 'frequency': {'key': 'frequency', 'type': 'str'}, + 'week_days': {'key': 'weekDays', 'type': '[str]'}, + 'interval': {'key': 'interval', 'type': 'int'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'date'}, } def __init__( self, **kwargs ): - super(RegisterPayload, self).__init__(**kwargs) - self.registration_code = kwargs.get('registration_code', None) + super(RecurrencePattern, self).__init__(**kwargs) + self.frequency = kwargs['frequency'] + self.week_days = kwargs.get('week_days', None) + self.interval = kwargs.get('interval', None) + self.expiration_date = kwargs['expiration_date'] -class ResetPasswordPayload(msrest.serialization.Model): - """Represents the payload for resetting passwords. +class ResetPasswordBody(msrest.serialization.Model): + """Body of a reset password request. All required parameters must be populated in order to send to Azure. - :param environment_id: Required. The resourceId of the environment. - :type environment_id: str - :param username: The username for which the password will be reset. + :param username: Required. The user whose password is being reset. :type username: str - :param password: The password to assign to the user specified in. + :param password: Required. The password. :type password: str """ _validation = { - 'environment_id': {'required': True}, + 'username': {'required': True}, + 'password': {'required': True}, } _attribute_map = { - 'environment_id': {'key': 'environmentId', 'type': 'str'}, 'username': {'key': 'username', 'type': 'str'}, 'password': {'key': 'password', 'type': 'str'}, } @@ -1858,659 +1710,826 @@ def __init__( self, **kwargs ): - super(ResetPasswordPayload, self).__init__(**kwargs) - self.environment_id = kwargs['environment_id'] - self.username = kwargs.get('username', None) - self.password = kwargs.get('password', None) - - -class ResourceSet(msrest.serialization.Model): - """Represents a VM and the setting Id it was created for. - - :param vm_resource_id: VM resource Id for the environment. - :type vm_resource_id: str - :param resource_setting_id: resourceSettingId for the environment. - :type resource_setting_id: str - """ - - _attribute_map = { - 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, - 'resource_setting_id': {'key': 'resourceSettingId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSet, self).__init__(**kwargs) - self.vm_resource_id = kwargs.get('vm_resource_id', None) - self.resource_setting_id = kwargs.get('resource_setting_id', None) + super(ResetPasswordBody, self).__init__(**kwargs) + self.username = kwargs['username'] + self.password = kwargs['password'] -class ResourceSetFragment(msrest.serialization.Model): - """Represents a VM and the setting Id it was created for. +class RosterProfile(msrest.serialization.Model): + """The lab user list management profile. - :param vm_resource_id: VM resource Id for the environment. - :type vm_resource_id: str - :param resource_setting_id: resourceSettingId for the environment. - :type resource_setting_id: str + :param active_directory_group_id: The AAD group ID which this lab roster is populated from. + Having this set enables AAD sync mode. + :type active_directory_group_id: str + :param lti_context_id: The unique context identifier for the lab in the lms. + :type lti_context_id: str + :param lms_instance: The base URI identifying the lms instance. + :type lms_instance: str + :param lti_client_id: The unique id of the azure lab services tool in the lms. + :type lti_client_id: str + :param lti_roster_endpoint: The uri of the names and roles service endpoint on the lms for the + class attached to this lab. + :type lti_roster_endpoint: str """ _attribute_map = { - 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, - 'resource_setting_id': {'key': 'resourceSettingId', 'type': 'str'}, + 'active_directory_group_id': {'key': 'activeDirectoryGroupId', 'type': 'str'}, + 'lti_context_id': {'key': 'ltiContextId', 'type': 'str'}, + 'lms_instance': {'key': 'lmsInstance', 'type': 'str'}, + 'lti_client_id': {'key': 'ltiClientId', 'type': 'str'}, + 'lti_roster_endpoint': {'key': 'ltiRosterEndpoint', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResourceSetFragment, self).__init__(**kwargs) - self.vm_resource_id = kwargs.get('vm_resource_id', None) - self.resource_setting_id = kwargs.get('resource_setting_id', None) - + super(RosterProfile, self).__init__(**kwargs) + self.active_directory_group_id = kwargs.get('active_directory_group_id', None) + self.lti_context_id = kwargs.get('lti_context_id', None) + self.lms_instance = kwargs.get('lms_instance', None) + self.lti_client_id = kwargs.get('lti_client_id', None) + self.lti_roster_endpoint = kwargs.get('lti_roster_endpoint', None) -class ResourceSettingCreationParameters(msrest.serialization.Model): - """Represents resource specific settings. - All required parameters must be populated in order to send to Azure. +class SaveImageBody(msrest.serialization.Model): + """Body for the save image POST. - :param location: The location where the virtual machine will live. - :type location: str - :param name: The name of the resource setting. + :param name: The name for the image we create. :type name: str - :param gallery_image_resource_id: Required. The resource id of the gallery image used for - creating the virtual machine. - :type gallery_image_resource_id: str - :param size: The size of the virtual machine. Possible values include: "Basic", "Standard", - "Performance". - :type size: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param reference_vm_creation_parameters: Required. Creation parameters for Reference Vm. - :type reference_vm_creation_parameters: - ~azure.mgmt.labservices.models.ReferenceVmCreationParameters + :param lab_virtual_machine_id: The ID of the lab virtual machine you want to save an image + from. + :type lab_virtual_machine_id: str """ _validation = { - 'gallery_image_resource_id': {'required': True}, - 'reference_vm_creation_parameters': {'required': True}, + 'lab_virtual_machine_id': {'max_length': 2000, 'min_length': 3}, } _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'gallery_image_resource_id': {'key': 'galleryImageResourceId', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'reference_vm_creation_parameters': {'key': 'referenceVmCreationParameters', 'type': 'ReferenceVmCreationParameters'}, + 'lab_virtual_machine_id': {'key': 'labVirtualMachineId', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResourceSettingCreationParameters, self).__init__(**kwargs) - self.location = kwargs.get('location', None) + super(SaveImageBody, self).__init__(**kwargs) self.name = kwargs.get('name', None) - self.gallery_image_resource_id = kwargs['gallery_image_resource_id'] - self.size = kwargs.get('size', None) - self.reference_vm_creation_parameters = kwargs['reference_vm_creation_parameters'] + self.lab_virtual_machine_id = kwargs.get('lab_virtual_machine_id', None) -class ResourceSettings(msrest.serialization.Model): - """Represents resource specific settings. +class Schedule(ProxyResource): + """Schedule for automatically turning virtual machines in a lab on and off at specified times. 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: The unique id of the resource setting. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :param gallery_image_resource_id: The resource id of the gallery image used for creating the - virtual machine. - :type gallery_image_resource_id: str - :ivar image_name: The name of the image used to created the environment setting. - :vartype image_name: str - :param size: The size of the virtual machine. Possible values include: "Basic", "Standard", - "Performance". - :type size: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :ivar cores: The translated compute cores of the virtual machine. - :vartype cores: int - :param reference_vm: Required. Details specific to Reference Vm. - :type reference_vm: ~azure.mgmt.labservices.models.ReferenceVm + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the schedule. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param start_at: When lab user virtual machines will be started. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type start_at: ~datetime.datetime + :param stop_at: When lab user virtual machines will be stopped. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type stop_at: ~datetime.datetime + :param recurrence_pattern: The recurrence pattern of the scheduled actions. + :type recurrence_pattern: ~azure.mgmt.labservices.models.RecurrencePattern + :param time_zone_id: The IANA timezone id for the schedule. + :type time_zone_id: str + :param notes: Notes for this schedule. + :type notes: str + :ivar provisioning_state: Current provisioning state of the schedule. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState """ _validation = { 'id': {'readonly': True}, - 'image_name': {'readonly': True}, - 'cores': {'readonly': True}, - 'reference_vm': {'required': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'time_zone_id': {'max_length': 50, 'min_length': 0}, + 'notes': {'max_length': 1000, 'min_length': 0}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'gallery_image_resource_id': {'key': 'galleryImageResourceId', 'type': 'str'}, - 'image_name': {'key': 'imageName', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'cores': {'key': 'cores', 'type': 'int'}, - 'reference_vm': {'key': 'referenceVm', 'type': 'ReferenceVm'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'start_at': {'key': 'properties.startAt', 'type': 'iso-8601'}, + 'stop_at': {'key': 'properties.stopAt', 'type': 'iso-8601'}, + 'recurrence_pattern': {'key': 'properties.recurrencePattern', 'type': 'RecurrencePattern'}, + 'time_zone_id': {'key': 'properties.timeZoneId', 'type': 'str'}, + 'notes': {'key': 'properties.notes', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResourceSettings, self).__init__(**kwargs) - self.id = None - self.gallery_image_resource_id = kwargs.get('gallery_image_resource_id', None) - self.image_name = None - self.size = kwargs.get('size', None) - self.cores = None - self.reference_vm = kwargs['reference_vm'] + super(Schedule, self).__init__(**kwargs) + self.system_data = None + self.start_at = kwargs.get('start_at', None) + self.stop_at = kwargs.get('stop_at', None) + self.recurrence_pattern = kwargs.get('recurrence_pattern', None) + self.time_zone_id = kwargs.get('time_zone_id', None) + self.notes = kwargs.get('notes', None) + self.provisioning_state = None -class ResourceSettingsFragment(msrest.serialization.Model): - """Represents resource specific settings. +class ScheduleUpdateProperties(msrest.serialization.Model): + """Schedule resource properties used for updates. - :param gallery_image_resource_id: The resource id of the gallery image used for creating the - virtual machine. - :type gallery_image_resource_id: str - :param size: The size of the virtual machine. Possible values include: "Basic", "Standard", - "Performance". - :type size: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param reference_vm: Details specific to Reference Vm. - :type reference_vm: ~azure.mgmt.labservices.models.ReferenceVmFragment + :param start_at: When lab user virtual machines will be started. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type start_at: ~datetime.datetime + :param stop_at: When lab user virtual machines will be stopped. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type stop_at: ~datetime.datetime + :param recurrence_pattern: The recurrence pattern of the scheduled actions. + :type recurrence_pattern: ~azure.mgmt.labservices.models.RecurrencePattern + :param time_zone_id: The IANA timezone id for the schedule. + :type time_zone_id: str + :param notes: Notes for this schedule. + :type notes: str """ + _validation = { + 'time_zone_id': {'max_length': 50, 'min_length': 0}, + 'notes': {'max_length': 1000, 'min_length': 0}, + } + _attribute_map = { - 'gallery_image_resource_id': {'key': 'galleryImageResourceId', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'reference_vm': {'key': 'referenceVm', 'type': 'ReferenceVmFragment'}, + 'start_at': {'key': 'startAt', 'type': 'iso-8601'}, + 'stop_at': {'key': 'stopAt', 'type': 'iso-8601'}, + 'recurrence_pattern': {'key': 'recurrencePattern', 'type': 'RecurrencePattern'}, + 'time_zone_id': {'key': 'timeZoneId', 'type': 'str'}, + 'notes': {'key': 'notes', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResourceSettingsFragment, self).__init__(**kwargs) - self.gallery_image_resource_id = kwargs.get('gallery_image_resource_id', None) - self.size = kwargs.get('size', None) - self.reference_vm = kwargs.get('reference_vm', None) + super(ScheduleUpdateProperties, self).__init__(**kwargs) + self.start_at = kwargs.get('start_at', None) + self.stop_at = kwargs.get('stop_at', None) + self.recurrence_pattern = kwargs.get('recurrence_pattern', None) + self.time_zone_id = kwargs.get('time_zone_id', None) + self.notes = kwargs.get('notes', None) + +class ScheduleProperties(ScheduleUpdateProperties): + """Schedule resource properties. -class ResponseWithContinuationEnvironment(msrest.serialization.Model): - """The response of a list operation. + Variables are only populated by the server, and will be ignored when sending a request. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.Environment] - :param next_link: Link for next set of results. - :type next_link: str + :param start_at: When lab user virtual machines will be started. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type start_at: ~datetime.datetime + :param stop_at: When lab user virtual machines will be stopped. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type stop_at: ~datetime.datetime + :param recurrence_pattern: The recurrence pattern of the scheduled actions. + :type recurrence_pattern: ~azure.mgmt.labservices.models.RecurrencePattern + :param time_zone_id: The IANA timezone id for the schedule. + :type time_zone_id: str + :param notes: Notes for this schedule. + :type notes: str + :ivar provisioning_state: Current provisioning state of the schedule. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState """ + _validation = { + 'time_zone_id': {'max_length': 50, 'min_length': 0}, + 'notes': {'max_length': 1000, 'min_length': 0}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[Environment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'start_at': {'key': 'startAt', 'type': 'iso-8601'}, + 'stop_at': {'key': 'stopAt', 'type': 'iso-8601'}, + 'recurrence_pattern': {'key': 'recurrencePattern', 'type': 'RecurrencePattern'}, + 'time_zone_id': {'key': 'timeZoneId', 'type': 'str'}, + 'notes': {'key': 'notes', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResponseWithContinuationEnvironment, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + super(ScheduleProperties, self).__init__(**kwargs) + self.provisioning_state = None -class ResponseWithContinuationEnvironmentSetting(msrest.serialization.Model): - """The response of a list operation. +class ScheduleUpdate(msrest.serialization.Model): + """Schedule for automatically turning virtual machines in a lab on and off at specified times. Used for updates. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.EnvironmentSetting] - :param next_link: Link for next set of results. - :type next_link: str + :param start_at: When lab user virtual machines will be started. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type start_at: ~datetime.datetime + :param stop_at: When lab user virtual machines will be stopped. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type stop_at: ~datetime.datetime + :param recurrence_pattern: The recurrence pattern of the scheduled actions. + :type recurrence_pattern: ~azure.mgmt.labservices.models.RecurrencePattern + :param time_zone_id: The IANA timezone id for the schedule. + :type time_zone_id: str + :param notes: Notes for this schedule. + :type notes: str """ + _validation = { + 'time_zone_id': {'max_length': 50, 'min_length': 0}, + 'notes': {'max_length': 1000, 'min_length': 0}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[EnvironmentSetting]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'start_at': {'key': 'properties.startAt', 'type': 'iso-8601'}, + 'stop_at': {'key': 'properties.stopAt', 'type': 'iso-8601'}, + 'recurrence_pattern': {'key': 'properties.recurrencePattern', 'type': 'RecurrencePattern'}, + 'time_zone_id': {'key': 'properties.timeZoneId', 'type': 'str'}, + 'notes': {'key': 'properties.notes', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResponseWithContinuationEnvironmentSetting, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + super(ScheduleUpdate, self).__init__(**kwargs) + self.start_at = kwargs.get('start_at', None) + self.stop_at = kwargs.get('stop_at', None) + self.recurrence_pattern = kwargs.get('recurrence_pattern', None) + self.time_zone_id = kwargs.get('time_zone_id', None) + self.notes = kwargs.get('notes', None) -class ResponseWithContinuationGalleryImage(msrest.serialization.Model): - """The response of a list operation. +class SecurityProfile(msrest.serialization.Model): + """The lab security profile. + + Variables are only populated by the server, and will be ignored when sending a request. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.GalleryImage] - :param next_link: Link for next set of results. - :type next_link: str + :ivar registration_code: The registration code for the lab. + :vartype registration_code: str + :param open_access: Whether any user or only specified users can register to a lab. Possible + values include: "Enabled", "Disabled". + :type open_access: str or ~azure.mgmt.labservices.models.EnableState """ + _validation = { + 'registration_code': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'registration_code': {'key': 'registrationCode', 'type': 'str'}, + 'open_access': {'key': 'openAccess', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResponseWithContinuationGalleryImage, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + super(SecurityProfile, self).__init__(**kwargs) + self.registration_code = None + self.open_access = kwargs.get('open_access', None) + +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. -class ResponseWithContinuationLab(msrest.serialization.Model): - """The response of a list operation. + All required parameters must be populated in order to send to Azure. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.Lab] - :param next_link: Link for next set of results. - :type next_link: str + :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :type name: str + :param tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.labservices.models.SkuTier + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int """ + _validation = { + 'name': {'required': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[Lab]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, } def __init__( self, **kwargs ): - super(ResponseWithContinuationLab, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.capacity = kwargs.get('capacity', None) -class ResponseWithContinuationLabAccount(msrest.serialization.Model): - """The response of a list operation. +class SupportInfo(msrest.serialization.Model): + """Support contact information and instructions. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.LabAccount] - :param next_link: Link for next set of results. - :type next_link: str + :param url: Support web address. + :type url: str + :param email: Support contact email address. + :type email: str + :param phone: Support contact phone number. + :type phone: str + :param instructions: Support instructions. + :type instructions: str """ + _validation = { + 'url': {'max_length': 2000, 'min_length': 3}, + 'email': {'max_length': 254, 'min_length': 6}, + 'phone': {'max_length': 31, 'min_length': 1}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[LabAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'instructions': {'key': 'instructions', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ResponseWithContinuationLabAccount, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + super(SupportInfo, self).__init__(**kwargs) + self.url = kwargs.get('url', None) + self.email = kwargs.get('email', None) + self.phone = kwargs.get('phone', None) + self.instructions = kwargs.get('instructions', None) -class ResponseWithContinuationUser(msrest.serialization.Model): - """The response of a list operation. +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.User] - :param next_link: Link for next set of results. - :type next_link: str + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.labservices.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.labservices.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, } def __init__( self, **kwargs ): - super(ResponseWithContinuationUser, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) -class SizeAvailability(msrest.serialization.Model): - """Represents the size information. +class User(ProxyResource): + """User of a lab that can register for and use virtual machines within the lab. - :param size_category: The category of the size (Basic, Standard, Performance). Possible values - include: "Basic", "Standard", "Performance". - :type size_category: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param is_available: Whether or not this size category is available. - :type is_available: bool + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the user resource. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param additional_usage_quota: The amount of usage quota time the user gets in addition to the + lab usage quota. + :type additional_usage_quota: ~datetime.timedelta + :ivar provisioning_state: Current provisioning state of the user resource. Possible values + include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar display_name: Display name of the user, for example user's full name. + :vartype display_name: str + :param email: Required. Email address of the user. + :type email: str + :ivar registration_state: State of the user's registration within the lab. Possible values + include: "Registered", "NotRegistered". + :vartype registration_state: str or ~azure.mgmt.labservices.models.RegistrationState + :ivar invitation_state: State of the invitation message for the user. Possible values include: + "NotSent", "Sending", "Sent", "Failed". + :vartype invitation_state: str or ~azure.mgmt.labservices.models.InvitationState + :ivar invitation_sent: Date and time when the invitation message was sent to the user. + :vartype invitation_sent: ~datetime.datetime + :ivar total_usage: How long the user has used their virtual machines in this lab. + :vartype total_usage: ~datetime.timedelta """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'display_name': {'readonly': True}, + 'email': {'required': True, 'max_length': 254, 'min_length': 6}, + 'registration_state': {'readonly': True}, + 'invitation_state': {'readonly': True}, + 'invitation_sent': {'readonly': True}, + 'total_usage': {'readonly': True}, + } + _attribute_map = { - 'size_category': {'key': 'sizeCategory', 'type': 'str'}, - 'is_available': {'key': 'isAvailable', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'additional_usage_quota': {'key': 'properties.additionalUsageQuota', 'type': 'duration'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'email': {'key': 'properties.email', 'type': 'str'}, + 'registration_state': {'key': 'properties.registrationState', 'type': 'str'}, + 'invitation_state': {'key': 'properties.invitationState', 'type': 'str'}, + 'invitation_sent': {'key': 'properties.invitationSent', 'type': 'iso-8601'}, + 'total_usage': {'key': 'properties.totalUsage', 'type': 'duration'}, } def __init__( self, **kwargs ): - super(SizeAvailability, self).__init__(**kwargs) - self.size_category = kwargs.get('size_category', None) - self.is_available = kwargs.get('is_available', None) + super(User, self).__init__(**kwargs) + self.system_data = None + self.additional_usage_quota = kwargs.get('additional_usage_quota', None) + self.provisioning_state = None + self.display_name = None + self.email = kwargs['email'] + self.registration_state = None + self.invitation_state = None + self.invitation_sent = None + self.total_usage = None -class SizeConfigurationProperties(msrest.serialization.Model): - """Represents the size configuration under the lab account. +class UserUpdateProperties(msrest.serialization.Model): + """User resource properties used for updates. - :param environment_sizes: Represents a list of size categories supported by this Lab Account - (Small, Medium, Large). - :type environment_sizes: list[~azure.mgmt.labservices.models.EnvironmentSize] + :param additional_usage_quota: The amount of usage quota time the user gets in addition to the + lab usage quota. + :type additional_usage_quota: ~datetime.timedelta """ _attribute_map = { - 'environment_sizes': {'key': 'environmentSizes', 'type': '[EnvironmentSize]'}, + 'additional_usage_quota': {'key': 'additionalUsageQuota', 'type': 'duration'}, } def __init__( self, **kwargs ): - super(SizeConfigurationProperties, self).__init__(**kwargs) - self.environment_sizes = kwargs.get('environment_sizes', None) + super(UserUpdateProperties, self).__init__(**kwargs) + self.additional_usage_quota = kwargs.get('additional_usage_quota', None) -class SizeConfigurationPropertiesFragment(msrest.serialization.Model): - """Represents the size configuration under the lab account. +class UserProperties(UserUpdateProperties): + """User resource properties. - :param environment_sizes: Represents a list of size categories supported by this Lab Account - (Small, Medium, Large). - :type environment_sizes: list[~azure.mgmt.labservices.models.EnvironmentSizeFragment] - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - 'environment_sizes': {'key': 'environmentSizes', 'type': '[EnvironmentSizeFragment]'}, - } + All required parameters must be populated in order to send to Azure. - def __init__( - self, - **kwargs - ): - super(SizeConfigurationPropertiesFragment, self).__init__(**kwargs) - self.environment_sizes = kwargs.get('environment_sizes', None) - - -class SizeInfo(msrest.serialization.Model): - """Contains detailed information about a size. - - :param compute_size: Represents the actual compute size, e.g. Standard_A2_v2. - :type compute_size: str - :param price: The pay-as-you-go price per hour this size will cost. It does not include - discounts and may not reflect the actual price the size will cost. - :type price: float - :param number_of_cores: The number of cores a VM of this size has. - :type number_of_cores: int - :param memory: The amount of memory available (in GB). - :type memory: float + :param additional_usage_quota: The amount of usage quota time the user gets in addition to the + lab usage quota. + :type additional_usage_quota: ~datetime.timedelta + :ivar provisioning_state: Current provisioning state of the user resource. Possible values + include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar display_name: Display name of the user, for example user's full name. + :vartype display_name: str + :param email: Required. Email address of the user. + :type email: str + :ivar registration_state: State of the user's registration within the lab. Possible values + include: "Registered", "NotRegistered". + :vartype registration_state: str or ~azure.mgmt.labservices.models.RegistrationState + :ivar invitation_state: State of the invitation message for the user. Possible values include: + "NotSent", "Sending", "Sent", "Failed". + :vartype invitation_state: str or ~azure.mgmt.labservices.models.InvitationState + :ivar invitation_sent: Date and time when the invitation message was sent to the user. + :vartype invitation_sent: ~datetime.datetime + :ivar total_usage: How long the user has used their virtual machines in this lab. + :vartype total_usage: ~datetime.timedelta """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'display_name': {'readonly': True}, + 'email': {'required': True, 'max_length': 254, 'min_length': 6}, + 'registration_state': {'readonly': True}, + 'invitation_state': {'readonly': True}, + 'invitation_sent': {'readonly': True}, + 'total_usage': {'readonly': True}, + } + _attribute_map = { - 'compute_size': {'key': 'computeSize', 'type': 'str'}, - 'price': {'key': 'price', 'type': 'float'}, - 'number_of_cores': {'key': 'numberOfCores', 'type': 'int'}, - 'memory': {'key': 'memory', 'type': 'float'}, + 'additional_usage_quota': {'key': 'additionalUsageQuota', 'type': 'duration'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'invitation_state': {'key': 'invitationState', 'type': 'str'}, + 'invitation_sent': {'key': 'invitationSent', 'type': 'iso-8601'}, + 'total_usage': {'key': 'totalUsage', 'type': 'duration'}, } def __init__( self, **kwargs ): - super(SizeInfo, self).__init__(**kwargs) - self.compute_size = kwargs.get('compute_size', None) - self.price = kwargs.get('price', None) - self.number_of_cores = kwargs.get('number_of_cores', None) - self.memory = kwargs.get('memory', None) - - -class SizeInfoFragment(msrest.serialization.Model): - """Contains detailed information about a size. - - :param compute_size: Represents the actual compute size, e.g. Standard_A2_v2. - :type compute_size: str - :param price: The pay-as-you-go price per hour this size will cost. It does not include - discounts and may not reflect the actual price the size will cost. - :type price: float - :param number_of_cores: The number of cores a VM of this size has. - :type number_of_cores: int - :param memory: The amount of memory available (in GB). - :type memory: float + super(UserProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.display_name = None + self.email = kwargs['email'] + self.registration_state = None + self.invitation_state = None + self.invitation_sent = None + self.total_usage = None + + +class UserUpdate(msrest.serialization.Model): + """User of a lab that can register for and use virtual machines within the lab. Used for updates. + + :param additional_usage_quota: The amount of usage quota time the user gets in addition to the + lab usage quota. + :type additional_usage_quota: ~datetime.timedelta """ _attribute_map = { - 'compute_size': {'key': 'computeSize', 'type': 'str'}, - 'price': {'key': 'price', 'type': 'float'}, - 'number_of_cores': {'key': 'numberOfCores', 'type': 'int'}, - 'memory': {'key': 'memory', 'type': 'float'}, + 'additional_usage_quota': {'key': 'properties.additionalUsageQuota', 'type': 'duration'}, } def __init__( self, **kwargs ): - super(SizeInfoFragment, self).__init__(**kwargs) - self.compute_size = kwargs.get('compute_size', None) - self.price = kwargs.get('price', None) - self.number_of_cores = kwargs.get('number_of_cores', None) - self.memory = kwargs.get('memory', None) + super(UserUpdate, self).__init__(**kwargs) + self.additional_usage_quota = kwargs.get('additional_usage_quota', None) -class User(Resource): - """The User registered to a lab. +class VirtualMachine(ProxyResource): + """A lab virtual machine resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar email: The user email address, as it was specified during registration. - :vartype email: str - :ivar family_name: The user family name, as it was specified during registration. - :vartype family_name: str - :ivar given_name: The user given name, as it was specified during registration. - :vartype given_name: str - :ivar tenant_id: The user tenant ID, as it was specified during registration. - :vartype tenant_id: str - :ivar total_usage: How long the user has used his VMs in this lab. - :vartype total_usage: ~datetime.timedelta - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult + :ivar system_data: System data of the Lab virtual machine. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :ivar provisioning_state: Current provisioning state of the virtual machine. Possible values + include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar state: The current state of the virtual machine. Possible values include: "Stopped", + "Starting", "Running", "Stopping", "ResettingPassword", "Reimaging", "Redeploying". + :vartype state: str or ~azure.mgmt.labservices.models.VirtualMachineState + :ivar connection_profile: Profile for information about connecting to the virtual machine. + :vartype connection_profile: ~azure.mgmt.labservices.models.VirtualMachineConnectionProfile + :ivar claimed_by_user_id: The lab user ID (not the PUID!) of who claimed the virtual machine. + :vartype claimed_by_user_id: str + :ivar vm_type: The type of this VM resource. Possible values include: "User", "Template". + :vartype vm_type: str or ~azure.mgmt.labservices.models.VirtualMachineType """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'email': {'readonly': True}, - 'family_name': {'readonly': True}, - 'given_name': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'total_usage': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'connection_profile': {'readonly': True}, + 'claimed_by_user_id': {'readonly': True}, + 'vm_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}'}, - 'email': {'key': 'properties.email', 'type': 'str'}, - 'family_name': {'key': 'properties.familyName', 'type': 'str'}, - 'given_name': {'key': 'properties.givenName', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'total_usage': {'key': 'properties.totalUsage', 'type': 'duration'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'connection_profile': {'key': 'properties.connectionProfile', 'type': 'VirtualMachineConnectionProfile'}, + 'claimed_by_user_id': {'key': 'properties.claimedByUserId', 'type': 'str'}, + 'vm_type': {'key': 'properties.vmType', 'type': 'str'}, } def __init__( self, **kwargs ): - super(User, self).__init__(**kwargs) - self.email = None - self.family_name = None - self.given_name = None - self.tenant_id = None - self.total_usage = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) - self.latest_operation_result = None - + super(VirtualMachine, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.state = None + self.connection_profile = None + self.claimed_by_user_id = None + self.vm_type = None -class UserFragment(Resource): - """The User registered to a lab. - Variables are only populated by the server, and will be ignored when sending a request. +class VirtualMachineAdditionalCapabilities(msrest.serialization.Model): + """The additional capabilities for a lab VM. - :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 - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str + :param install_gpu_drivers: Flag to pre-install dedicated GPU drivers. Possible values include: + "Enabled", "Disabled". + :type install_gpu_drivers: str or ~azure.mgmt.labservices.models.EnableState """ - _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}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, + 'install_gpu_drivers': {'key': 'installGpuDrivers', 'type': 'str'}, } def __init__( self, **kwargs ): - super(UserFragment, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.unique_identifier = kwargs.get('unique_identifier', None) + super(VirtualMachineAdditionalCapabilities, self).__init__(**kwargs) + self.install_gpu_drivers = kwargs.get('install_gpu_drivers', None) -class VirtualMachineDetails(msrest.serialization.Model): - """Details of the backing virtual machine. +class VirtualMachineConnectionProfile(msrest.serialization.Model): + """The connection information for the virtual machine. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Dtl VM. - :vartype provisioning_state: str - :ivar rdp_authority: Connection information for Windows. - :vartype rdp_authority: str - :ivar ssh_authority: Connection information for Linux. - :vartype ssh_authority: str - :ivar private_ip_address: PrivateIp address of the compute VM. + :ivar private_ip_address: The private IP address of the virtual machine. :vartype private_ip_address: str - :ivar user_name: Compute VM login user name. - :vartype user_name: str - :ivar last_known_power_state: Last known compute power state captured in DTL. - :vartype last_known_power_state: str + :ivar ssh_authority: Port and host name separated by semicolon for connecting via SSH protocol + to the virtual machine. + :vartype ssh_authority: str + :ivar ssh_in_browser_url: URL for connecting via SSH protocol to the virtual machine in + browser. + :vartype ssh_in_browser_url: str + :ivar rdp_authority: Port and host name separated by semicolon for connecting via RDP protocol + to the virtual machine. + :vartype rdp_authority: str + :ivar rdp_in_browser_url: URL for connecting via RDP protocol to the virtual machine in + browser. + :vartype rdp_in_browser_url: str + :ivar admin_username: The username used to log on to the virtual machine as admin. + :vartype admin_username: str + :ivar non_admin_username: The username used to log on to the virtual machine as non-admin, if + one exists. + :vartype non_admin_username: str """ _validation = { - 'provisioning_state': {'readonly': True}, - 'rdp_authority': {'readonly': True}, - 'ssh_authority': {'readonly': True}, 'private_ip_address': {'readonly': True}, - 'user_name': {'readonly': True}, - 'last_known_power_state': {'readonly': True}, + 'ssh_authority': {'readonly': True}, + 'ssh_in_browser_url': {'readonly': True, 'max_length': 2000, 'min_length': 3}, + 'rdp_authority': {'readonly': True}, + 'rdp_in_browser_url': {'readonly': True, 'max_length': 2000, 'min_length': 3}, + 'admin_username': {'readonly': True}, + 'non_admin_username': {'readonly': True}, } _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'rdp_authority': {'key': 'rdpAuthority', 'type': 'str'}, - 'ssh_authority': {'key': 'sshAuthority', 'type': 'str'}, 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, - 'user_name': {'key': 'userName', 'type': 'str'}, - 'last_known_power_state': {'key': 'lastKnownPowerState', 'type': 'str'}, + 'ssh_authority': {'key': 'sshAuthority', 'type': 'str'}, + 'ssh_in_browser_url': {'key': 'sshInBrowserUrl', 'type': 'str'}, + 'rdp_authority': {'key': 'rdpAuthority', 'type': 'str'}, + 'rdp_in_browser_url': {'key': 'rdpInBrowserUrl', 'type': 'str'}, + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'non_admin_username': {'key': 'nonAdminUsername', 'type': 'str'}, } def __init__( self, **kwargs ): - super(VirtualMachineDetails, self).__init__(**kwargs) - self.provisioning_state = None - self.rdp_authority = None - self.ssh_authority = None + super(VirtualMachineConnectionProfile, self).__init__(**kwargs) self.private_ip_address = None - self.user_name = None - self.last_known_power_state = None + self.ssh_authority = None + self.ssh_in_browser_url = None + self.rdp_authority = None + self.rdp_in_browser_url = None + self.admin_username = None + self.non_admin_username = None -class VmStateDetails(msrest.serialization.Model): - """Details about the state of the reference virtual machine. +class VirtualMachineProfile(msrest.serialization.Model): + """The base virtual machine configuration for a lab. Variables are only populated by the server, and will be ignored when sending a request. - :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 power_state: The power state of the reference virtual machine. - :vartype power_state: str - :ivar last_known_power_state: Last known compute power state captured in DTL. - :vartype last_known_power_state: str + All required parameters must be populated in order to send to Azure. + + :param create_option: Required. Indicates what lab virtual machines are created from. Possible + values include: "Image", "TemplateVM". + :type create_option: str or ~azure.mgmt.labservices.models.CreateOption + :param image_reference: Required. The image configuration for lab virtual machines. + :type image_reference: ~azure.mgmt.labservices.models.ImageReference + :ivar os_type: The OS type of the image. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.labservices.models.OsType + :param sku: Required. The SKU for the lab. Defines the type of virtual machines used in the + lab. + :type sku: ~azure.mgmt.labservices.models.Sku + :param additional_capabilities: Additional VM capabilities. + :type additional_capabilities: + ~azure.mgmt.labservices.models.VirtualMachineAdditionalCapabilities + :param usage_quota: Required. The initial quota alloted to each lab user. Must be a time span + between 0 and 9999 hours. + :type usage_quota: ~datetime.timedelta + :param use_shared_password: Enabling this option will use the same password for all user VMs. + Possible values include: "Enabled", "Disabled". + :type use_shared_password: str or ~azure.mgmt.labservices.models.EnableState + :param admin_user: Required. Credentials for the admin user on the VM. + :type admin_user: ~azure.mgmt.labservices.models.Credentials + :param non_admin_user: Credentials for the non-admin user on the VM, if one exists. + :type non_admin_user: ~azure.mgmt.labservices.models.Credentials """ _validation = { - 'rdp_authority': {'readonly': True}, - 'ssh_authority': {'readonly': True}, - 'power_state': {'readonly': True}, - 'last_known_power_state': {'readonly': True}, + 'create_option': {'required': True}, + 'image_reference': {'required': True}, + 'os_type': {'readonly': True}, + 'sku': {'required': True}, + 'usage_quota': {'required': True}, + 'admin_user': {'required': True}, } _attribute_map = { - 'rdp_authority': {'key': 'rdpAuthority', 'type': 'str'}, - 'ssh_authority': {'key': 'sshAuthority', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'str'}, - 'last_known_power_state': {'key': 'lastKnownPowerState', 'type': 'str'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'additional_capabilities': {'key': 'additionalCapabilities', 'type': 'VirtualMachineAdditionalCapabilities'}, + 'usage_quota': {'key': 'usageQuota', 'type': 'duration'}, + 'use_shared_password': {'key': 'useSharedPassword', 'type': 'str'}, + 'admin_user': {'key': 'adminUser', 'type': 'Credentials'}, + 'non_admin_user': {'key': 'nonAdminUser', 'type': 'Credentials'}, } def __init__( self, **kwargs ): - super(VmStateDetails, self).__init__(**kwargs) - self.rdp_authority = None - self.ssh_authority = None - self.power_state = None - self.last_known_power_state = None + super(VirtualMachineProfile, self).__init__(**kwargs) + self.create_option = kwargs['create_option'] + self.image_reference = kwargs['image_reference'] + self.os_type = None + self.sku = kwargs['sku'] + self.additional_capabilities = kwargs.get('additional_capabilities', None) + self.usage_quota = kwargs['usage_quota'] + self.use_shared_password = kwargs.get('use_shared_password', None) + self.admin_user = kwargs['admin_user'] + self.non_admin_user = kwargs.get('non_admin_user', None) diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_models_py3.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_models_py3.py index bfe8d872e419..75100c5088dc 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_models_py3.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/models/_models_py3.py @@ -9,362 +9,245 @@ import datetime from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._managed_labs_client_enums import * +from ._lab_services_client_enums import * -class AddUsersPayload(msrest.serialization.Model): - """Payload for Add Users operation on a Lab. +class AutoShutdownProfile(msrest.serialization.Model): + """Profile for how to handle shutting down virtual machines. - All required parameters must be populated in order to send to Azure. - - :param email_addresses: Required. List of user emails addresses to add to the lab. - :type email_addresses: list[str] + :param shutdown_on_disconnect: Whether shutdown on disconnect is enabled. Possible values + include: "Enabled", "Disabled". + :type shutdown_on_disconnect: str or ~azure.mgmt.labservices.models.EnableState + :param shutdown_when_not_connected: Whether a VM will get shutdown when it hasn't been + connected to after a period of time. Possible values include: "Enabled", "Disabled". + :type shutdown_when_not_connected: str or ~azure.mgmt.labservices.models.EnableState + :param shutdown_on_idle: Whether a VM will get shutdown when it has idled for a period of time. + Possible values include: "None", "UserAbsence", "LowUsage". + :type shutdown_on_idle: str or ~azure.mgmt.labservices.models.ShutdownOnIdleMode + :param disconnect_delay: The amount of time a VM will stay running after a user disconnects if + this behavior is enabled. + :type disconnect_delay: ~datetime.timedelta + :param no_connect_delay: The amount of time a VM will stay running before it is shutdown if no + connection is made and this behavior is enabled. + :type no_connect_delay: ~datetime.timedelta + :param idle_delay: The amount of time a VM will idle before it is shutdown if this behavior is + enabled. + :type idle_delay: ~datetime.timedelta """ - _validation = { - 'email_addresses': {'required': True}, - } - _attribute_map = { - 'email_addresses': {'key': 'emailAddresses', 'type': '[str]'}, + 'shutdown_on_disconnect': {'key': 'shutdownOnDisconnect', 'type': 'str'}, + 'shutdown_when_not_connected': {'key': 'shutdownWhenNotConnected', 'type': 'str'}, + 'shutdown_on_idle': {'key': 'shutdownOnIdle', 'type': 'str'}, + 'disconnect_delay': {'key': 'disconnectDelay', 'type': 'duration'}, + 'no_connect_delay': {'key': 'noConnectDelay', 'type': 'duration'}, + 'idle_delay': {'key': 'idleDelay', 'type': 'duration'}, } def __init__( self, *, - email_addresses: List[str], + shutdown_on_disconnect: Optional[Union[str, "EnableState"]] = None, + shutdown_when_not_connected: Optional[Union[str, "EnableState"]] = None, + shutdown_on_idle: Optional[Union[str, "ShutdownOnIdleMode"]] = None, + disconnect_delay: Optional[datetime.timedelta] = None, + no_connect_delay: Optional[datetime.timedelta] = None, + idle_delay: Optional[datetime.timedelta] = None, **kwargs ): - super(AddUsersPayload, self).__init__(**kwargs) - self.email_addresses = email_addresses + super(AutoShutdownProfile, self).__init__(**kwargs) + self.shutdown_on_disconnect = shutdown_on_disconnect + self.shutdown_when_not_connected = shutdown_when_not_connected + self.shutdown_on_idle = shutdown_on_idle + self.disconnect_delay = disconnect_delay + self.no_connect_delay = no_connect_delay + self.idle_delay = idle_delay -class CloudErrorBody(msrest.serialization.Model): - """Body of an error from a REST request. +class ConnectionProfile(msrest.serialization.Model): + """Connection profile for how users connect to lab virtual machines. - :param code: - :type code: str - :param message: - :type message: str - :param target: - :type target: str - :param details: Inner errors. - :type details: list[~azure.mgmt.labservices.models.CloudErrorBody] + :param web_ssh_access: The enabled access level for Web Access over SSH. Possible values + include: "Public", "Private", "None". + :type web_ssh_access: str or ~azure.mgmt.labservices.models.ConnectionType + :param web_rdp_access: The enabled access level for Web Access over RDP. Possible values + include: "Public", "Private", "None". + :type web_rdp_access: str or ~azure.mgmt.labservices.models.ConnectionType + :param client_ssh_access: The enabled access level for Client Access over SSH. Possible values + include: "Public", "Private", "None". + :type client_ssh_access: str or ~azure.mgmt.labservices.models.ConnectionType + :param client_rdp_access: The enabled access level for Client Access over RDP. Possible values + include: "Public", "Private", "None". + :type client_rdp_access: str or ~azure.mgmt.labservices.models.ConnectionType """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + 'web_ssh_access': {'key': 'webSshAccess', 'type': 'str'}, + 'web_rdp_access': {'key': 'webRdpAccess', 'type': 'str'}, + 'client_ssh_access': {'key': 'clientSshAccess', 'type': 'str'}, + 'client_rdp_access': {'key': 'clientRdpAccess', 'type': 'str'}, } def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + web_ssh_access: Optional[Union[str, "ConnectionType"]] = None, + web_rdp_access: Optional[Union[str, "ConnectionType"]] = None, + client_ssh_access: Optional[Union[str, "ConnectionType"]] = None, + client_rdp_access: Optional[Union[str, "ConnectionType"]] = None, **kwargs ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details + super(ConnectionProfile, self).__init__(**kwargs) + self.web_ssh_access = web_ssh_access + self.web_rdp_access = web_rdp_access + self.client_ssh_access = client_ssh_access + self.client_rdp_access = client_rdp_access -class CreateLabProperties(msrest.serialization.Model): - """Properties for creating a managed lab and a default environment setting. +class Credentials(msrest.serialization.Model): + """Credentials for a user on a lab VM. All required parameters must be populated in order to send to Azure. - :param environment_setting_creation_parameters: Settings related to creating an environment - setting. - :type environment_setting_creation_parameters: - ~azure.mgmt.labservices.models.EnvironmentSettingCreationParameters - :param lab_creation_parameters: Required. Settings related to creating a lab. - :type lab_creation_parameters: ~azure.mgmt.labservices.models.LabCreationParameters - :param name: Required. The name of the resource. - :type name: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :param username: Required. The username to use when signing in to lab VMs. + :type username: str + :param password: The password for the user. This is required for the TemplateVM createOption. + :type password: str """ _validation = { - 'lab_creation_parameters': {'required': True}, - 'name': {'required': True}, + 'username': {'required': True}, } _attribute_map = { - 'environment_setting_creation_parameters': {'key': 'environmentSettingCreationParameters', 'type': 'EnvironmentSettingCreationParameters'}, - 'lab_creation_parameters': {'key': 'labCreationParameters', 'type': 'LabCreationParameters'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, } def __init__( self, *, - lab_creation_parameters: "LabCreationParameters", - name: str, - environment_setting_creation_parameters: Optional["EnvironmentSettingCreationParameters"] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, + username: str, + password: Optional[str] = None, **kwargs ): - super(CreateLabProperties, self).__init__(**kwargs) - self.environment_setting_creation_parameters = environment_setting_creation_parameters - self.lab_creation_parameters = lab_creation_parameters - self.name = name - self.location = location - self.tags = tags + super(Credentials, self).__init__(**kwargs) + self.username = username + self.password = password -class Resource(msrest.serialization.Model): - """An Azure resource. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. 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. - :vartype name: str - :ivar type: The type of the resource. + :ivar type: The additional info type. :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] + :ivar info: The additional info. + :vartype info: any """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, 'type': {'readonly': True}, + 'info': {'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}'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, **kwargs ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None + super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None - self.location = location - self.tags = tags + self.info = None -class Environment(Resource): - """Represents an environment instance. +class ErrorDetail(msrest.serialization.Model): + """The error detail. 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. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param resource_sets: The set of a VM and the setting id it was created for. - :type resource_sets: ~azure.mgmt.labservices.models.ResourceSet - :ivar claimed_by_user_object_id: The AAD object Id of the user who has claimed the environment. - :vartype claimed_by_user_object_id: str - :ivar claimed_by_user_principal_id: The user principal Id of the user who has claimed the - environment. - :vartype claimed_by_user_principal_id: str - :ivar claimed_by_user_name: The name or email address of the user who has claimed the - environment. - :vartype claimed_by_user_name: str - :ivar is_claimed: Is the environment claimed or not. - :vartype is_claimed: bool - :ivar last_known_power_state: Last known power state of the environment. - :vartype last_known_power_state: str - :ivar network_interface: Network details of the environment. - :vartype network_interface: ~azure.mgmt.labservices.models.NetworkInterface - :ivar total_usage: How long the environment has been used by a lab user. - :vartype total_usage: ~datetime.timedelta - :ivar password_last_reset: When the password was last reset on the environment. - :vartype password_last_reset: ~datetime.datetime - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.labservices.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.labservices.models.ErrorAdditionalInfo] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'claimed_by_user_object_id': {'readonly': True}, - 'claimed_by_user_principal_id': {'readonly': True}, - 'claimed_by_user_name': {'readonly': True}, - 'is_claimed': {'readonly': True}, - 'last_known_power_state': {'readonly': True}, - 'network_interface': {'readonly': True}, - 'total_usage': {'readonly': True}, - 'password_last_reset': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'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}'}, - 'resource_sets': {'key': 'properties.resourceSets', 'type': 'ResourceSet'}, - 'claimed_by_user_object_id': {'key': 'properties.claimedByUserObjectId', 'type': 'str'}, - 'claimed_by_user_principal_id': {'key': 'properties.claimedByUserPrincipalId', 'type': 'str'}, - 'claimed_by_user_name': {'key': 'properties.claimedByUserName', 'type': 'str'}, - 'is_claimed': {'key': 'properties.isClaimed', 'type': 'bool'}, - 'last_known_power_state': {'key': 'properties.lastKnownPowerState', 'type': 'str'}, - 'network_interface': {'key': 'properties.networkInterface', 'type': 'NetworkInterface'}, - 'total_usage': {'key': 'properties.totalUsage', 'type': 'duration'}, - 'password_last_reset': {'key': 'properties.passwordLastReset', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - resource_sets: Optional["ResourceSet"] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, **kwargs ): - super(Environment, self).__init__(location=location, tags=tags, **kwargs) - self.resource_sets = resource_sets - self.claimed_by_user_object_id = None - self.claimed_by_user_principal_id = None - self.claimed_by_user_name = None - self.is_claimed = None - self.last_known_power_state = None - self.network_interface = None - self.total_usage = None - self.password_last_reset = None - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - self.latest_operation_result = None - + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None -class EnvironmentDetails(msrest.serialization.Model): - """This represents the details about a User's environment and its state. - Variables are only populated by the server, and will be ignored when sending a request. +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :ivar name: Name of the Environment. - :vartype name: str - :ivar description: Description of the Environment. - :vartype description: str - :ivar id: Resource Id of the environment. - :vartype id: str - :ivar provisioning_state: The provisioning state of the environment. This also includes - LabIsFull and NotYetProvisioned status. - :vartype provisioning_state: str - :ivar virtual_machine_details: Details of backing DTL virtual machine with compute and network - details. - :vartype virtual_machine_details: ~azure.mgmt.labservices.models.VirtualMachineDetails - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult - :ivar environment_state: Publishing state of the environment setting Possible values are - Creating, Created, Failed. - :vartype environment_state: str - :ivar total_usage: How long the environment has been used by a lab user. - :vartype total_usage: ~datetime.timedelta - :ivar password_last_reset: When the password was last reset on the environment. - :vartype password_last_reset: ~datetime.datetime + :param error: The error object. + :type error: ~azure.mgmt.labservices.models.ErrorDetail """ - _validation = { - 'name': {'readonly': True}, - 'description': {'readonly': True}, - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'virtual_machine_details': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, - 'environment_state': {'readonly': True}, - 'total_usage': {'readonly': True}, - 'password_last_reset': {'readonly': True}, - } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'virtual_machine_details': {'key': 'virtualMachineDetails', 'type': 'VirtualMachineDetails'}, - 'latest_operation_result': {'key': 'latestOperationResult', 'type': 'LatestOperationResult'}, - 'environment_state': {'key': 'environmentState', 'type': 'str'}, - 'total_usage': {'key': 'totalUsage', 'type': 'duration'}, - 'password_last_reset': {'key': 'passwordLastReset', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, + *, + error: Optional["ErrorDetail"] = None, **kwargs ): - super(EnvironmentDetails, self).__init__(**kwargs) - self.name = None - self.description = None - self.id = None - self.provisioning_state = None - self.virtual_machine_details = None - self.latest_operation_result = None - self.environment_state = None - self.total_usage = None - self.password_last_reset = None + super(ErrorResponse, self).__init__(**kwargs) + self.error = error -class EnvironmentFragment(Resource): - """Represents an environment instance. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param resource_sets: The set of a VM and the setting id it was created for. - :type resource_sets: ~azure.mgmt.labservices.models.ResourceSetFragment - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str """ _validation = { @@ -377,1297 +260,1234 @@ class EnvironmentFragment(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}'}, - 'resource_sets': {'key': 'properties.resourceSets', 'type': 'ResourceSetFragment'}, - '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, - resource_sets: Optional["ResourceSetFragment"] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, **kwargs ): - super(EnvironmentFragment, self).__init__(location=location, tags=tags, **kwargs) - self.resource_sets = resource_sets - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - - -class EnvironmentOperationsPayload(msrest.serialization.Model): - """Represents payload for any Environment operations like get, start, stop, connect. - - All required parameters must be populated in order to send to Azure. - - :param environment_id: Required. The resourceId of the environment. - :type environment_id: str - """ - - _validation = { - 'environment_id': {'required': True}, - } - - _attribute_map = { - 'environment_id': {'key': 'environmentId', 'type': 'str'}, - } - - def __init__( - self, - *, - environment_id: str, - **kwargs - ): - super(EnvironmentOperationsPayload, self).__init__(**kwargs) - self.environment_id = environment_id + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class EnvironmentSetting(Resource): - """Represents settings of an environment, from which environment instances would be created. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar publishing_state: Describes the readiness of this environment setting. Possible values - include: "Draft", "Publishing", "Published", "PublishFailed", "Scaling". - :vartype publishing_state: str or ~azure.mgmt.labservices.models.PublishingState - :param configuration_state: Describes the user's progress in configuring their environment - setting. Possible values include: "NotApplicable", "Completed". - :type configuration_state: str or ~azure.mgmt.labservices.models.ConfigurationState - :param description: Describes the environment and its resource settings. - :type description: str - :param title: Brief title describing the environment and its resource settings. - :type title: str - :param resource_settings: The resource specific settings. - :type resource_settings: ~azure.mgmt.labservices.models.ResourceSettings - :ivar last_changed: Time when the template VM was last changed. - :vartype last_changed: ~datetime.datetime - :ivar last_published: Time when the template VM was last sent for publishing. - :vartype last_published: ~datetime.datetime - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'publishing_state': {'readonly': True}, - 'last_changed': {'readonly': True}, - 'last_published': {'readonly': True}, - 'latest_operation_result': {'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}'}, - 'publishing_state': {'key': 'properties.publishingState', 'type': 'str'}, - 'configuration_state': {'key': 'properties.configurationState', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'resource_settings': {'key': 'properties.resourceSettings', 'type': 'ResourceSettings'}, - 'last_changed': {'key': 'properties.lastChanged', 'type': 'iso-8601'}, - 'last_published': {'key': 'properties.lastPublished', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - configuration_state: Optional[Union[str, "ConfigurationState"]] = None, - description: Optional[str] = None, - title: Optional[str] = None, - resource_settings: Optional["ResourceSettings"] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, - **kwargs - ): - super(EnvironmentSetting, self).__init__(location=location, tags=tags, **kwargs) - self.publishing_state = None - self.configuration_state = configuration_state - self.description = description - self.title = title - self.resource_settings = resource_settings - self.last_changed = None - self.last_published = None - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - self.latest_operation_result = None - - -class EnvironmentSettingCreationParameters(msrest.serialization.Model): - """Settings related to creating an environment setting. - - All required parameters must be populated in order to send to Azure. - - :param resource_setting_creation_parameters: Required. The resource specific settings. - :type resource_setting_creation_parameters: - ~azure.mgmt.labservices.models.ResourceSettingCreationParameters - """ - - _validation = { - 'resource_setting_creation_parameters': {'required': True}, - } - - _attribute_map = { - 'resource_setting_creation_parameters': {'key': 'resourceSettingCreationParameters', 'type': 'ResourceSettingCreationParameters'}, } def __init__( self, - *, - resource_setting_creation_parameters: "ResourceSettingCreationParameters", **kwargs ): - super(EnvironmentSettingCreationParameters, self).__init__(**kwargs) - self.resource_setting_creation_parameters = resource_setting_creation_parameters + super(ProxyResource, self).__init__(**kwargs) -class EnvironmentSettingFragment(Resource): - """Represents settings of an environment, from which environment instances would be created. +class Image(ProxyResource): + """Lab services virtual machine image. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param configuration_state: Describes the user's progress in configuring their environment - setting. Possible values include: "NotApplicable", "Completed". - :type configuration_state: str or ~azure.mgmt.labservices.models.ConfigurationState - :param description: Describes the environment and its resource settings. - :type description: str - :param title: Brief title describing the environment and its resource settings. - :type title: str - :param resource_settings: The resource specific settings. - :type resource_settings: ~azure.mgmt.labservices.models.ResourceSettingsFragment - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str + :ivar system_data: Metadata pertaining to creation and last modification of the image. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param enabled_state: Is the image enabled. Possible values include: "Enabled", "Disabled". + :type enabled_state: str or ~azure.mgmt.labservices.models.EnableState + :ivar provisioning_state: Current provisioning state of the image. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar display_name: The image display name. + :vartype display_name: str + :ivar description: A description of the image. + :vartype description: str + :ivar icon_url: URL of the image icon. + :vartype icon_url: str + :ivar author: The image author. + :vartype author: str + :ivar os_type: The OS Type of the image. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.labservices.models.OsType + :ivar plan: The ID of marketplace plan associated with the image (optional). + :vartype plan: str + :ivar terms_status: The status of image terms of use (enabled = accepted, disabled = not + accepted). Possible values include: "Enabled", "Disabled". + :vartype terms_status: str or ~azure.mgmt.labservices.models.EnableState + :ivar offer: The ID of an offer associated with the image. + :vartype offer: str + :ivar publisher: The ID of the publisher of the image. + :vartype publisher: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar version: The image version. + :vartype version: str + :ivar shared_gallery_id: The ID for the image in the shared gallery. + :vartype shared_gallery_id: str + :param available_regions: The available regions of the image in the shared gallery. + :type available_regions: list[str] + :ivar os_state: The OS State of the image. Possible values include: "Generalized", + "Specialized". + :vartype os_state: str or ~azure.mgmt.labservices.models.OsState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'icon_url': {'readonly': True}, + 'author': {'readonly': True}, + 'os_type': {'readonly': True}, + 'plan': {'readonly': True}, + 'terms_status': {'readonly': True}, + 'offer': {'readonly': True}, + 'publisher': {'readonly': True}, + 'sku': {'readonly': True}, + 'version': {'readonly': True}, + 'shared_gallery_id': {'readonly': True, 'max_length': 2000, 'min_length': 3}, + 'os_state': {'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}'}, - 'configuration_state': {'key': 'properties.configurationState', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'title': {'key': 'properties.title', 'type': 'str'}, - 'resource_settings': {'key': 'properties.resourceSettings', 'type': 'ResourceSettingsFragment'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'enabled_state': {'key': 'properties.enabledState', '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, - configuration_state: Optional[Union[str, "ConfigurationState"]] = None, - description: Optional[str] = None, - title: Optional[str] = None, - resource_settings: Optional["ResourceSettingsFragment"] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, - **kwargs - ): - super(EnvironmentSettingFragment, self).__init__(location=location, tags=tags, **kwargs) - self.configuration_state = configuration_state - self.description = description - self.title = title - self.resource_settings = resource_settings - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - - -class EnvironmentSize(msrest.serialization.Model): - """Represents a size category supported by this Lab Account (small, medium or large). - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: The size category. Possible values include: "Basic", "Standard", "Performance". - :type name: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param vm_sizes: Represents a set of compute sizes that can serve this given size type. - :type vm_sizes: list[~azure.mgmt.labservices.models.SizeInfo] - :ivar max_price: The pay-as-you-go dollar price per hour this size will cost. It does not - include discounts and may not reflect the actual price the size will cost. This is the maximum - price of all prices within this tier. - :vartype max_price: float - :ivar min_number_of_cores: The number of cores a VM of this size has. This is the minimum - number of cores within this tier. - :vartype min_number_of_cores: int - :ivar min_memory: The amount of memory available (in GB). This is the minimum amount of memory - within this tier. - :vartype min_memory: float - """ - - _validation = { - 'max_price': {'readonly': True}, - 'min_number_of_cores': {'readonly': True}, - 'min_memory': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'vm_sizes': {'key': 'vmSizes', 'type': '[SizeInfo]'}, - 'max_price': {'key': 'maxPrice', 'type': 'float'}, - 'min_number_of_cores': {'key': 'minNumberOfCores', 'type': 'int'}, - 'min_memory': {'key': 'minMemory', 'type': 'float'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'icon_url': {'key': 'properties.iconUrl', 'type': 'str'}, + 'author': {'key': 'properties.author', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'plan': {'key': 'properties.plan', 'type': 'str'}, + 'terms_status': {'key': 'properties.termsStatus', 'type': 'str'}, + 'offer': {'key': 'properties.offer', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'sku': {'key': 'properties.sku', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'shared_gallery_id': {'key': 'properties.sharedGalleryId', 'type': 'str'}, + 'available_regions': {'key': 'properties.availableRegions', 'type': '[str]'}, + 'os_state': {'key': 'properties.osState', 'type': 'str'}, } def __init__( self, *, - name: Optional[Union[str, "ManagedLabVmSize"]] = None, - vm_sizes: Optional[List["SizeInfo"]] = None, + enabled_state: Optional[Union[str, "EnableState"]] = None, + available_regions: Optional[List[str]] = None, **kwargs ): - super(EnvironmentSize, self).__init__(**kwargs) - self.name = name - self.vm_sizes = vm_sizes - self.max_price = None - self.min_number_of_cores = None - self.min_memory = None + super(Image, self).__init__(**kwargs) + self.system_data = None + self.enabled_state = enabled_state + self.provisioning_state = None + self.display_name = None + self.description = None + self.icon_url = None + self.author = None + self.os_type = None + self.plan = None + self.terms_status = None + self.offer = None + self.publisher = None + self.sku = None + self.version = None + self.shared_gallery_id = None + self.available_regions = available_regions + self.os_state = None -class EnvironmentSizeFragment(msrest.serialization.Model): - """Represents a size category supported by this Lab Account (small, medium or large). +class ImageUpdateProperties(msrest.serialization.Model): + """Properties of an image resource update. - :param name: The size category. Possible values include: "Basic", "Standard", "Performance". - :type name: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param vm_sizes: Represents a set of compute sizes that can serve this given size type. - :type vm_sizes: list[~azure.mgmt.labservices.models.SizeInfoFragment] + :param enabled_state: Is the image enabled. Possible values include: "Enabled", "Disabled". + :type enabled_state: str or ~azure.mgmt.labservices.models.EnableState """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'vm_sizes': {'key': 'vmSizes', 'type': '[SizeInfoFragment]'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, } def __init__( self, *, - name: Optional[Union[str, "ManagedLabVmSize"]] = None, - vm_sizes: Optional[List["SizeInfoFragment"]] = None, + enabled_state: Optional[Union[str, "EnableState"]] = None, **kwargs ): - super(EnvironmentSizeFragment, self).__init__(**kwargs) - self.name = name - self.vm_sizes = vm_sizes + super(ImageUpdateProperties, self).__init__(**kwargs) + self.enabled_state = enabled_state -class GalleryImage(Resource): - """Represents an image from the Azure Marketplace. +class ImageProperties(ImageUpdateProperties): + """Properties of an image resource. 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. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :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. + :param enabled_state: Is the image enabled. Possible values include: "Enabled", "Disabled". + :type enabled_state: str or ~azure.mgmt.labservices.models.EnableState + :ivar provisioning_state: Current provisioning state of the image. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar display_name: The image display name. + :vartype display_name: str + :ivar description: A description of the image. :vartype description: str - :ivar image_reference: The image reference of the gallery image. - :vartype image_reference: ~azure.mgmt.labservices.models.GalleryImageReference - :ivar icon: The icon of the gallery image. - :vartype icon: str - :param is_enabled: Indicates whether this gallery image is enabled. - :type is_enabled: bool - :param is_override: Indicates whether this gallery has been overridden for this lab account. - :type is_override: bool - :ivar plan_id: The third party plan that applies to this image. - :vartype plan_id: str - :param is_plan_authorized: Indicates if the plan has been authorized for programmatic - deployment. - :type is_plan_authorized: bool - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult + :ivar icon_url: URL of the image icon. + :vartype icon_url: str + :ivar author: The image author. + :vartype author: str + :ivar os_type: The OS Type of the image. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.labservices.models.OsType + :ivar plan: The ID of marketplace plan associated with the image (optional). + :vartype plan: str + :ivar terms_status: The status of image terms of use (enabled = accepted, disabled = not + accepted). Possible values include: "Enabled", "Disabled". + :vartype terms_status: str or ~azure.mgmt.labservices.models.EnableState + :ivar offer: The ID of an offer associated with the image. + :vartype offer: str + :ivar publisher: The ID of the publisher of the image. + :vartype publisher: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar version: The image version. + :vartype version: str + :ivar shared_gallery_id: The ID for the image in the shared gallery. + :vartype shared_gallery_id: str + :param available_regions: The available regions of the image in the shared gallery. + :type available_regions: list[str] + :ivar os_state: The OS State of the image. Possible values include: "Generalized", + "Specialized". + :vartype os_state: str or ~azure.mgmt.labservices.models.OsState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'author': {'readonly': True}, - 'created_date': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'display_name': {'readonly': True}, 'description': {'readonly': True}, - 'image_reference': {'readonly': True}, - 'icon': {'readonly': True}, - 'plan_id': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, + 'icon_url': {'readonly': True}, + 'author': {'readonly': True}, + 'os_type': {'readonly': True}, + 'plan': {'readonly': True}, + 'terms_status': {'readonly': True}, + 'offer': {'readonly': True}, + 'publisher': {'readonly': True}, + 'sku': {'readonly': True}, + 'version': {'readonly': True}, + 'shared_gallery_id': {'readonly': True, 'max_length': 2000, 'min_length': 3}, + 'os_state': {'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}'}, - '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'}, - 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, - 'is_override': {'key': 'properties.isOverride', 'type': 'bool'}, - 'plan_id': {'key': 'properties.planId', 'type': 'str'}, - 'is_plan_authorized': {'key': 'properties.isPlanAuthorized', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'icon_url': {'key': 'iconUrl', 'type': 'str'}, + 'author': {'key': 'author', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'plan': {'key': 'plan', 'type': 'str'}, + 'terms_status': {'key': 'termsStatus', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'shared_gallery_id': {'key': 'sharedGalleryId', 'type': 'str'}, + 'available_regions': {'key': 'availableRegions', 'type': '[str]'}, + 'os_state': {'key': 'osState', 'type': 'str'}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - is_enabled: Optional[bool] = None, - is_override: Optional[bool] = None, - is_plan_authorized: Optional[bool] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, + enabled_state: Optional[Union[str, "EnableState"]] = None, + available_regions: Optional[List[str]] = None, **kwargs ): - super(GalleryImage, self).__init__(location=location, tags=tags, **kwargs) - self.author = None - self.created_date = None + super(ImageProperties, self).__init__(enabled_state=enabled_state, **kwargs) + self.provisioning_state = None + self.display_name = None self.description = None - self.image_reference = None - self.icon = None - self.is_enabled = is_enabled - self.is_override = is_override - self.plan_id = None - self.is_plan_authorized = is_plan_authorized - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - self.latest_operation_result = None + self.icon_url = None + self.author = None + self.os_type = None + self.plan = None + self.terms_status = None + self.offer = None + self.publisher = None + self.sku = None + self.version = None + self.shared_gallery_id = None + self.available_regions = available_regions + self.os_state = None -class GalleryImageFragment(Resource): - """Represents an image from the Azure Marketplace. +class ImageReference(msrest.serialization.Model): + """Image reference information. Used in the virtual machine profile. 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. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param is_enabled: Indicates whether this gallery image is enabled. - :type is_enabled: bool - :param is_override: Indicates whether this gallery has been overridden for this lab account. - :type is_override: bool - :param is_plan_authorized: Indicates if the plan has been authorized for programmatic - deployment. - :type is_plan_authorized: bool - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, - 'is_override': {'key': 'properties.isOverride', 'type': 'bool'}, - 'is_plan_authorized': {'key': 'properties.isPlanAuthorized', 'type': 'bool'}, - '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, - is_enabled: Optional[bool] = None, - is_override: Optional[bool] = None, - is_plan_authorized: Optional[bool] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, - **kwargs - ): - super(GalleryImageFragment, self).__init__(location=location, tags=tags, **kwargs) - self.is_enabled = is_enabled - self.is_override = is_override - self.is_plan_authorized = is_plan_authorized - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - - -class GalleryImageReference(msrest.serialization.Model): - """The reference information for an Azure Marketplace image. - - :param offer: The offer of the gallery image. + :param id: Image resource ID. + :type id: str + :param offer: The image offer if applicable. :type offer: str - :param publisher: The publisher of the gallery image. + :param publisher: The image publisher. :type publisher: str - :param sku: The SKU of the gallery image. + :param sku: The image SKU. :type sku: str - :param os_type: The OS type of the gallery image. - :type os_type: str - :param version: The version of the gallery image. + :param version: The image version specified on creation. :type version: str + :ivar exact_version: The actual version of the image after use. + :vartype exact_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'}, + _validation = { + 'id': {'max_length': 2000, 'min_length': 3}, + 'exact_version': {'readonly': True}, } - 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 - ): - super(GalleryImageReference, self).__init__(**kwargs) - self.offer = offer - self.publisher = publisher - self.sku = sku - self.os_type = os_type - self.version = version - - -class GalleryImageReferenceFragment(msrest.serialization.Model): - """The reference information for an Azure Marketplace image. - - :param offer: The offer of the gallery image. - :type offer: str - :param publisher: The publisher of the gallery image. - :type publisher: str - :param sku: The SKU of the gallery image. - :type sku: str - :param os_type: The OS type of the gallery image. - :type os_type: str - :param version: The version of the gallery image. - :type version: str - """ - _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, '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'}, + 'exact_version': {'key': 'exactVersion', 'type': 'str'}, } def __init__( self, *, + id: Optional[str] = None, offer: Optional[str] = None, publisher: Optional[str] = None, sku: Optional[str] = None, - os_type: Optional[str] = None, version: Optional[str] = None, **kwargs ): - super(GalleryImageReferenceFragment, self).__init__(**kwargs) + super(ImageReference, self).__init__(**kwargs) + self.id = id self.offer = offer self.publisher = publisher self.sku = sku - self.os_type = os_type self.version = version + self.exact_version = None -class GetEnvironmentResponse(msrest.serialization.Model): - """Represents the environments details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar environment: Details of the environment. - :vartype environment: ~azure.mgmt.labservices.models.EnvironmentDetails - """ - - _validation = { - 'environment': {'readonly': True}, - } - - _attribute_map = { - 'environment': {'key': 'environment', 'type': 'EnvironmentDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(GetEnvironmentResponse, self).__init__(**kwargs) - self.environment = None - - -class GetPersonalPreferencesResponse(msrest.serialization.Model): - """Represents the PersonalPreferences for the user. +class ImageUpdate(msrest.serialization.Model): + """Lab services virtual machine image for updates. - :param id: Id to be used by the cache orchestrator. - :type id: str - :param favorite_lab_resource_ids: Array of favorite lab resource ids. - :type favorite_lab_resource_ids: list[str] + :param enabled_state: Is the image enabled. Possible values include: "Enabled", "Disabled". + :type enabled_state: str or ~azure.mgmt.labservices.models.EnableState """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'favorite_lab_resource_ids': {'key': 'favoriteLabResourceIds', 'type': '[str]'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - favorite_lab_resource_ids: Optional[List[str]] = None, - **kwargs - ): - super(GetPersonalPreferencesResponse, self).__init__(**kwargs) - self.id = id - self.favorite_lab_resource_ids = favorite_lab_resource_ids - - -class GetRegionalAvailabilityResponse(msrest.serialization.Model): - """The response model from the GetRegionalAvailability action. - - :param regional_availability: Availability information for different size categories per - region. - :type regional_availability: list[~azure.mgmt.labservices.models.RegionalAvailability] - """ - - _attribute_map = { - 'regional_availability': {'key': 'regionalAvailability', 'type': '[RegionalAvailability]'}, - } - - def __init__( - self, - *, - regional_availability: Optional[List["RegionalAvailability"]] = None, - **kwargs - ): - super(GetRegionalAvailabilityResponse, self).__init__(**kwargs) - self.regional_availability = regional_availability - - -class Lab(Resource): - """Represents a lab. - - 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. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param max_users_in_lab: Maximum number of users allowed in the lab. - :type max_users_in_lab: int - :ivar user_quota: Maximum value MaxUsersInLab can be set to, as specified by the service. - :vartype user_quota: int - :ivar invitation_code: Invitation code that users can use to join a lab. - :vartype invitation_code: str - :ivar created_by_object_id: Object id of the user that created the lab. - :vartype created_by_object_id: str - :param usage_quota: Maximum duration a user can use an environment for in the lab. - :type usage_quota: ~datetime.timedelta - :param user_access_mode: Lab user access mode (open to all vs. restricted to those listed on - the lab). Possible values include: "Restricted", "Open". - :type user_access_mode: str or ~azure.mgmt.labservices.models.LabUserAccessMode - :ivar created_by_user_principal_name: Lab creator name. - :vartype created_by_user_principal_name: str - :ivar created_date: Creation date for the lab. - :vartype created_date: ~datetime.datetime - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'user_quota': {'readonly': True}, - 'invitation_code': {'readonly': True}, - 'created_by_object_id': {'readonly': True}, - 'created_by_user_principal_name': {'readonly': True}, - 'created_date': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, + 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, } + def __init__( + self, + *, + enabled_state: Optional[Union[str, "EnableState"]] = None, + **kwargs + ): + super(ImageUpdate, self).__init__(**kwargs) + self.enabled_state = enabled_state + + +class InviteBody(msrest.serialization.Model): + """Body for a user invite request. + + :param text: Custom text for the invite email. + :type text: str + """ + _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}'}, - 'max_users_in_lab': {'key': 'properties.maxUsersInLab', 'type': 'int'}, - 'user_quota': {'key': 'properties.userQuota', 'type': 'int'}, - 'invitation_code': {'key': 'properties.invitationCode', 'type': 'str'}, - 'created_by_object_id': {'key': 'properties.createdByObjectId', 'type': 'str'}, - 'usage_quota': {'key': 'properties.usageQuota', 'type': 'duration'}, - 'user_access_mode': {'key': 'properties.userAccessMode', 'type': 'str'}, - 'created_by_user_principal_name': {'key': 'properties.createdByUserPrincipalName', 'type': 'str'}, - 'created_date': {'key': 'properties.createdDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'text': {'key': 'text', 'type': 'str'}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - max_users_in_lab: Optional[int] = None, - usage_quota: Optional[datetime.timedelta] = None, - user_access_mode: Optional[Union[str, "LabUserAccessMode"]] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, + text: Optional[str] = None, **kwargs ): - super(Lab, self).__init__(location=location, tags=tags, **kwargs) - self.max_users_in_lab = max_users_in_lab - self.user_quota = None - self.invitation_code = None - self.created_by_object_id = None - self.usage_quota = usage_quota - self.user_access_mode = user_access_mode - self.created_by_user_principal_name = None - self.created_date = None - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - self.latest_operation_result = None + super(InviteBody, self).__init__(**kwargs) + self.text = text -class LabAccount(Resource): - """Represents a lab account. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :ivar size_configuration: Represents the size configuration under the lab account. - :vartype size_configuration: ~azure.mgmt.labservices.models.SizeConfigurationProperties - :param enabled_region_selection: Represents if region selection is enabled. - :type enabled_region_selection: bool - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult + :param location: Required. The geo-location where the resource lives. + :type location: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'size_configuration': {'readonly': True}, - 'latest_operation_result': {'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}'}, - 'size_configuration': {'key': 'properties.sizeConfiguration', 'type': 'SizeConfigurationProperties'}, - 'enabled_region_selection': {'key': 'properties.enabledRegionSelection', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'location': {'key': 'location', 'type': 'str'}, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - enabled_region_selection: Optional[bool] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, **kwargs ): - super(LabAccount, self).__init__(location=location, tags=tags, **kwargs) - self.size_configuration = None - self.enabled_region_selection = enabled_region_selection - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - self.latest_operation_result = None + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location -class LabAccountFragment(Resource): - """Represents a lab account. +class Lab(TrackedResource): + """The lab resource. 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param enabled_region_selection: Represents if region selection is enabled. - :type enabled_region_selection: bool - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the lab. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param auto_shutdown_profile: The resource auto shutdown configuration for the lab. This + controls whether actions are taken on resources that are sitting idle. + :type auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param connection_profile: The connection profile for the lab. This controls settings such as + web access to lab resources or whether RDP or SSH ports are open. + :type connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param virtual_machine_profile: The profile used for creating lab virtual machines. + :type virtual_machine_profile: ~azure.mgmt.labservices.models.VirtualMachineProfile + :param security_profile: The lab security profile. + :type security_profile: ~azure.mgmt.labservices.models.SecurityProfile + :param roster_profile: The lab user list management profile. + :type roster_profile: ~azure.mgmt.labservices.models.RosterProfile + :param lab_plan_id: The ID of the lab plan. Used during resource creation to provide defaults + and acts as a permission container when creating a lab via labs.azure.com. Setting a labPlanId + on an existing lab provides organization.. + :type lab_plan_id: str + :param title: The title of the lab. + :type title: str + :param description: The description of the lab. + :type description: str + :ivar provisioning_state: Current provisioning state of the lab. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :param network_profile: The network profile for the lab, typically applied via a lab plan. This + profile cannot be modified once a lab has been created. + :type network_profile: ~azure.mgmt.labservices.models.LabNetworkProfile + :ivar state: The lab state. Possible values include: "Draft", "Publishing", "Scaling", + "Syncing", "Published". + :vartype state: str or ~azure.mgmt.labservices.models.LabState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'lab_plan_id': {'max_length': 2000, 'min_length': 3}, + 'title': {'max_length': 120, 'min_length': 1}, + 'provisioning_state': {'readonly': True}, + 'state': {'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}'}, - 'enabled_region_selection': {'key': 'properties.enabledRegionSelection', 'type': 'bool'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'auto_shutdown_profile': {'key': 'properties.autoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'connection_profile': {'key': 'properties.connectionProfile', 'type': 'ConnectionProfile'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'roster_profile': {'key': 'properties.rosterProfile', 'type': 'RosterProfile'}, + 'lab_plan_id': {'key': 'properties.labPlanId', 'type': 'str'}, + 'title': {'key': 'properties.title', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'LabNetworkProfile'}, + 'state': {'key': 'properties.state', 'type': 'str'}, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - enabled_region_selection: Optional[bool] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, - **kwargs - ): - super(LabAccountFragment, self).__init__(location=location, tags=tags, **kwargs) - self.enabled_region_selection = enabled_region_selection - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - - -class LabCreationParameters(msrest.serialization.Model): - """Settings related to creating a lab. - - :param max_users_in_lab: Maximum number of users allowed in the lab. - :type max_users_in_lab: int - """ - - _attribute_map = { - 'max_users_in_lab': {'key': 'maxUsersInLab', 'type': 'int'}, - } - - def __init__( - self, - *, - max_users_in_lab: Optional[int] = None, + auto_shutdown_profile: Optional["AutoShutdownProfile"] = None, + connection_profile: Optional["ConnectionProfile"] = None, + virtual_machine_profile: Optional["VirtualMachineProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + roster_profile: Optional["RosterProfile"] = None, + lab_plan_id: Optional[str] = None, + title: Optional[str] = None, + description: Optional[str] = None, + network_profile: Optional["LabNetworkProfile"] = None, **kwargs ): - super(LabCreationParameters, self).__init__(**kwargs) - self.max_users_in_lab = max_users_in_lab - + super(Lab, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.auto_shutdown_profile = auto_shutdown_profile + self.connection_profile = connection_profile + self.virtual_machine_profile = virtual_machine_profile + self.security_profile = security_profile + self.roster_profile = roster_profile + self.lab_plan_id = lab_plan_id + self.title = title + self.description = description + self.provisioning_state = None + self.network_profile = network_profile + self.state = None -class LabDetails(msrest.serialization.Model): - """This represents the details about a lab that the User is in, and its state. - Variables are only populated by the server, and will be ignored when sending a request. +class LabNetworkProfile(msrest.serialization.Model): + """Profile for how to handle networking for Labs. - :param name: Name of the lab. - :type name: str - :param provisioning_state: The provisioning state of the lab. - :type provisioning_state: str - :param id: The Id of the lab. - :type id: str - :ivar usage_quota: The maximum duration a user can use a VM in this lab. - :vartype usage_quota: ~datetime.timedelta + :param subnet_id: The external subnet resource id. + :type subnet_id: str + :param load_balancer_id: The external load balancer resource id. + :type load_balancer_id: str + :param public_ip_id: The external public IP resource id. + :type public_ip_id: str """ _validation = { - 'usage_quota': {'readonly': True}, + 'subnet_id': {'max_length': 2000, 'min_length': 3}, + 'load_balancer_id': {'max_length': 2000, 'min_length': 3}, + 'public_ip_id': {'max_length': 2000, 'min_length': 3}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'usage_quota': {'key': 'usageQuota', 'type': 'duration'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'load_balancer_id': {'key': 'loadBalancerId', 'type': 'str'}, + 'public_ip_id': {'key': 'publicIpId', 'type': 'str'}, } def __init__( self, *, - name: Optional[str] = None, - provisioning_state: Optional[str] = None, - id: Optional[str] = None, + subnet_id: Optional[str] = None, + load_balancer_id: Optional[str] = None, + public_ip_id: Optional[str] = None, **kwargs ): - super(LabDetails, self).__init__(**kwargs) - self.name = name - self.provisioning_state = provisioning_state - self.id = id - self.usage_quota = None + super(LabNetworkProfile, self).__init__(**kwargs) + self.subnet_id = subnet_id + self.load_balancer_id = load_balancer_id + self.public_ip_id = public_ip_id -class LabFragment(Resource): - """Represents a lab. +class LabPlan(TrackedResource): + """Lab Plans act as a permission container for creating labs via labs.azure.com. Additionally, they can provide a set of default configurations that will apply at the time of creating a lab, but these defaults can still be overwritten. 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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param max_users_in_lab: Maximum number of users allowed in the lab. - :type max_users_in_lab: int - :param usage_quota: Maximum duration a user can use an environment for in the lab. - :type usage_quota: ~datetime.timedelta - :param user_access_mode: Lab user access mode (open to all vs. restricted to those listed on - the lab). Possible values include: "Restricted", "Open". - :type user_access_mode: str or ~azure.mgmt.labservices.models.LabUserAccessMode - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the lab plan. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param default_connection_profile: The default lab connection profile. This can be changed on a + lab resource and only provides a default profile. + :type default_connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param default_auto_shutdown_profile: The default lab shutdown profile. This can be changed on + a lab resource and only provides a default profile. + :type default_auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param default_network_profile: The lab plan network profile. To enforce lab network policies + they must be defined here and cannot be changed when there are existing labs associated with + this lab plan. + :type default_network_profile: ~azure.mgmt.labservices.models.LabPlanNetworkProfile + :param allowed_regions: The allowed regions for the lab creator to use when creating labs using + this lab plan. + :type allowed_regions: list[str] + :param shared_gallery_id: Resource ID of the Shared Image Gallery attached to this lab plan. + When saving a lab template virtual machine image it will be persisted in this gallery. Shared + images from the gallery can be made available to use when creating new labs. + :type shared_gallery_id: str + :param support_info: Support contact information and instructions for users of the lab plan. + This information is displayed to lab owners and virtual machine users for all labs in the lab + plan. + :type support_info: ~azure.mgmt.labservices.models.SupportInfo + :param linked_lms_instance: Base Url of the lms instance this lab plan can link lab rosters + against. + :type linked_lms_instance: str + :ivar provisioning_state: Current provisioning state of the lab plan. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'shared_gallery_id': {'max_length': 2000, 'min_length': 3}, + 'linked_lms_instance': {'max_length': 2000, 'min_length': 3}, + 'provisioning_state': {'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}'}, - 'max_users_in_lab': {'key': 'properties.maxUsersInLab', 'type': 'int'}, - 'usage_quota': {'key': 'properties.usageQuota', 'type': 'duration'}, - 'user_access_mode': {'key': 'properties.userAccessMode', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'default_connection_profile': {'key': 'properties.defaultConnectionProfile', 'type': 'ConnectionProfile'}, + 'default_auto_shutdown_profile': {'key': 'properties.defaultAutoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'default_network_profile': {'key': 'properties.defaultNetworkProfile', 'type': 'LabPlanNetworkProfile'}, + 'allowed_regions': {'key': 'properties.allowedRegions', 'type': '[str]'}, + 'shared_gallery_id': {'key': 'properties.sharedGalleryId', 'type': 'str'}, + 'support_info': {'key': 'properties.supportInfo', 'type': 'SupportInfo'}, + 'linked_lms_instance': {'key': 'properties.linkedLmsInstance', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - max_users_in_lab: Optional[int] = None, - usage_quota: Optional[datetime.timedelta] = None, - user_access_mode: Optional[Union[str, "LabUserAccessMode"]] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, - **kwargs - ): - super(LabFragment, self).__init__(location=location, tags=tags, **kwargs) - self.max_users_in_lab = max_users_in_lab - self.usage_quota = usage_quota - self.user_access_mode = user_access_mode - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - + default_connection_profile: Optional["ConnectionProfile"] = None, + default_auto_shutdown_profile: Optional["AutoShutdownProfile"] = None, + default_network_profile: Optional["LabPlanNetworkProfile"] = None, + allowed_regions: Optional[List[str]] = None, + shared_gallery_id: Optional[str] = None, + support_info: Optional["SupportInfo"] = None, + linked_lms_instance: Optional[str] = None, + **kwargs + ): + super(LabPlan, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.default_connection_profile = default_connection_profile + self.default_auto_shutdown_profile = default_auto_shutdown_profile + self.default_network_profile = default_network_profile + self.allowed_regions = allowed_regions + self.shared_gallery_id = shared_gallery_id + self.support_info = support_info + self.linked_lms_instance = linked_lms_instance + self.provisioning_state = None -class LatestOperationResult(msrest.serialization.Model): - """Details of the status of an operation. - Variables are only populated by the server, and will be ignored when sending a request. +class LabPlanNetworkProfile(msrest.serialization.Model): + """Profile for how to handle networking for Lab Plans. - :ivar status: The current status of the operation. - :vartype status: str - :ivar error_code: Error code on failure. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - :ivar request_uri: Request URI of the operation. - :vartype request_uri: str - :ivar http_method: The HttpMethod - PUT/POST/DELETE for the operation. - :vartype http_method: str - :ivar operation_url: The URL to use to check long-running operation status. - :vartype operation_url: str + :param subnet_id: The external subnet resource id. + :type subnet_id: str """ _validation = { - 'status': {'readonly': True}, - 'error_code': {'readonly': True}, - 'error_message': {'readonly': True}, - 'request_uri': {'readonly': True}, - 'http_method': {'readonly': True}, - 'operation_url': {'readonly': True}, + 'subnet_id': {'max_length': 2000, 'min_length': 3}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'request_uri': {'key': 'requestUri', 'type': 'str'}, - 'http_method': {'key': 'httpMethod', 'type': 'str'}, - 'operation_url': {'key': 'operationUrl', 'type': 'str'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, } def __init__( self, - **kwargs - ): - super(LatestOperationResult, self).__init__(**kwargs) - self.status = None - self.error_code = None - self.error_message = None - self.request_uri = None - self.http_method = None - self.operation_url = None - - -class ListEnvironmentsPayload(msrest.serialization.Model): - """Represents the payload to list environments owned by a user. - - :param lab_id: The resource Id of the lab. - :type lab_id: str + *, + subnet_id: Optional[str] = None, + **kwargs + ): + super(LabPlanNetworkProfile, self).__init__(**kwargs) + self.subnet_id = subnet_id + + +class LabPlanUpdateProperties(msrest.serialization.Model): + """Lab plan resource properties for updates. + + :param default_connection_profile: The default lab connection profile. This can be changed on a + lab resource and only provides a default profile. + :type default_connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param default_auto_shutdown_profile: The default lab shutdown profile. This can be changed on + a lab resource and only provides a default profile. + :type default_auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param default_network_profile: The lab plan network profile. To enforce lab network policies + they must be defined here and cannot be changed when there are existing labs associated with + this lab plan. + :type default_network_profile: ~azure.mgmt.labservices.models.LabPlanNetworkProfile + :param allowed_regions: The allowed regions for the lab creator to use when creating labs using + this lab plan. + :type allowed_regions: list[str] + :param shared_gallery_id: Resource ID of the Shared Image Gallery attached to this lab plan. + When saving a lab template virtual machine image it will be persisted in this gallery. Shared + images from the gallery can be made available to use when creating new labs. + :type shared_gallery_id: str + :param support_info: Support contact information and instructions for users of the lab plan. + This information is displayed to lab owners and virtual machine users for all labs in the lab + plan. + :type support_info: ~azure.mgmt.labservices.models.SupportInfo + :param linked_lms_instance: Base Url of the lms instance this lab plan can link lab rosters + against. + :type linked_lms_instance: str """ + _validation = { + 'shared_gallery_id': {'max_length': 2000, 'min_length': 3}, + 'linked_lms_instance': {'max_length': 2000, 'min_length': 3}, + } + _attribute_map = { - 'lab_id': {'key': 'labId', 'type': 'str'}, + 'default_connection_profile': {'key': 'defaultConnectionProfile', 'type': 'ConnectionProfile'}, + 'default_auto_shutdown_profile': {'key': 'defaultAutoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'default_network_profile': {'key': 'defaultNetworkProfile', 'type': 'LabPlanNetworkProfile'}, + 'allowed_regions': {'key': 'allowedRegions', 'type': '[str]'}, + 'shared_gallery_id': {'key': 'sharedGalleryId', 'type': 'str'}, + 'support_info': {'key': 'supportInfo', 'type': 'SupportInfo'}, + 'linked_lms_instance': {'key': 'linkedLmsInstance', 'type': 'str'}, } def __init__( self, *, - lab_id: Optional[str] = None, + default_connection_profile: Optional["ConnectionProfile"] = None, + default_auto_shutdown_profile: Optional["AutoShutdownProfile"] = None, + default_network_profile: Optional["LabPlanNetworkProfile"] = None, + allowed_regions: Optional[List[str]] = None, + shared_gallery_id: Optional[str] = None, + support_info: Optional["SupportInfo"] = None, + linked_lms_instance: Optional[str] = None, **kwargs ): - super(ListEnvironmentsPayload, self).__init__(**kwargs) - self.lab_id = lab_id + super(LabPlanUpdateProperties, self).__init__(**kwargs) + self.default_connection_profile = default_connection_profile + self.default_auto_shutdown_profile = default_auto_shutdown_profile + self.default_network_profile = default_network_profile + self.allowed_regions = allowed_regions + self.shared_gallery_id = shared_gallery_id + self.support_info = support_info + self.linked_lms_instance = linked_lms_instance -class ListEnvironmentsResponse(msrest.serialization.Model): - """Represents the list of environments owned by a user. +class LabPlanProperties(LabPlanUpdateProperties): + """Lab plan resource properties. - :param environments: List of all the environments. - :type environments: list[~azure.mgmt.labservices.models.EnvironmentDetails] + Variables are only populated by the server, and will be ignored when sending a request. + + :param default_connection_profile: The default lab connection profile. This can be changed on a + lab resource and only provides a default profile. + :type default_connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param default_auto_shutdown_profile: The default lab shutdown profile. This can be changed on + a lab resource and only provides a default profile. + :type default_auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param default_network_profile: The lab plan network profile. To enforce lab network policies + they must be defined here and cannot be changed when there are existing labs associated with + this lab plan. + :type default_network_profile: ~azure.mgmt.labservices.models.LabPlanNetworkProfile + :param allowed_regions: The allowed regions for the lab creator to use when creating labs using + this lab plan. + :type allowed_regions: list[str] + :param shared_gallery_id: Resource ID of the Shared Image Gallery attached to this lab plan. + When saving a lab template virtual machine image it will be persisted in this gallery. Shared + images from the gallery can be made available to use when creating new labs. + :type shared_gallery_id: str + :param support_info: Support contact information and instructions for users of the lab plan. + This information is displayed to lab owners and virtual machine users for all labs in the lab + plan. + :type support_info: ~azure.mgmt.labservices.models.SupportInfo + :param linked_lms_instance: Base Url of the lms instance this lab plan can link lab rosters + against. + :type linked_lms_instance: str + :ivar provisioning_state: Current provisioning state of the lab plan. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState """ + _validation = { + 'shared_gallery_id': {'max_length': 2000, 'min_length': 3}, + 'linked_lms_instance': {'max_length': 2000, 'min_length': 3}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'environments': {'key': 'environments', 'type': '[EnvironmentDetails]'}, + 'default_connection_profile': {'key': 'defaultConnectionProfile', 'type': 'ConnectionProfile'}, + 'default_auto_shutdown_profile': {'key': 'defaultAutoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'default_network_profile': {'key': 'defaultNetworkProfile', 'type': 'LabPlanNetworkProfile'}, + 'allowed_regions': {'key': 'allowedRegions', 'type': '[str]'}, + 'shared_gallery_id': {'key': 'sharedGalleryId', 'type': 'str'}, + 'support_info': {'key': 'supportInfo', 'type': 'SupportInfo'}, + 'linked_lms_instance': {'key': 'linkedLmsInstance', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( self, *, - environments: Optional[List["EnvironmentDetails"]] = None, + default_connection_profile: Optional["ConnectionProfile"] = None, + default_auto_shutdown_profile: Optional["AutoShutdownProfile"] = None, + default_network_profile: Optional["LabPlanNetworkProfile"] = None, + allowed_regions: Optional[List[str]] = None, + shared_gallery_id: Optional[str] = None, + support_info: Optional["SupportInfo"] = None, + linked_lms_instance: Optional[str] = None, **kwargs ): - super(ListEnvironmentsResponse, self).__init__(**kwargs) - self.environments = environments + super(LabPlanProperties, self).__init__(default_connection_profile=default_connection_profile, default_auto_shutdown_profile=default_auto_shutdown_profile, default_network_profile=default_network_profile, allowed_regions=allowed_regions, shared_gallery_id=shared_gallery_id, support_info=support_info, linked_lms_instance=linked_lms_instance, **kwargs) + self.provisioning_state = None -class ListLabsResponse(msrest.serialization.Model): - """Lists the labs owned by a user. +class TrackedResourceUpdate(msrest.serialization.Model): + """Base tracked resource type for all PATCH updates. - :param labs: List of all the labs. - :type labs: list[~azure.mgmt.labservices.models.LabDetails] + :param tags: A set of tags. Resource tags. + :type tags: list[str] """ _attribute_map = { - 'labs': {'key': 'labs', 'type': '[LabDetails]'}, + 'tags': {'key': 'tags', 'type': '[str]'}, } def __init__( self, *, - labs: Optional[List["LabDetails"]] = None, + tags: Optional[List[str]] = None, **kwargs ): - super(ListLabsResponse, self).__init__(**kwargs) - self.labs = labs - - -class NetworkInterface(msrest.serialization.Model): - """Network details of the environment. + super(TrackedResourceUpdate, self).__init__(**kwargs) + self.tags = tags - Variables are only populated by the server, and will be ignored when sending a request. - :ivar private_ip_address: PrivateIp address of the Compute VM. - :vartype private_ip_address: str - :ivar ssh_authority: Connection information for Linux. - :vartype ssh_authority: str - :ivar rdp_authority: Connection information for Windows. - :vartype rdp_authority: str - :ivar username: Username of the VM. - :vartype username: str +class LabPlanUpdate(TrackedResourceUpdate): + """Contains lab configuration and default settings. This variant is used for PATCH. + + :param tags: A set of tags. Resource tags. + :type tags: list[str] + :param default_connection_profile: The default lab connection profile. This can be changed on a + lab resource and only provides a default profile. + :type default_connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param default_auto_shutdown_profile: The default lab shutdown profile. This can be changed on + a lab resource and only provides a default profile. + :type default_auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param default_network_profile: The lab plan network profile. To enforce lab network policies + they must be defined here and cannot be changed when there are existing labs associated with + this lab plan. + :type default_network_profile: ~azure.mgmt.labservices.models.LabPlanNetworkProfile + :param allowed_regions: The allowed regions for the lab creator to use when creating labs using + this lab plan. + :type allowed_regions: list[str] + :param shared_gallery_id: Resource ID of the Shared Image Gallery attached to this lab plan. + When saving a lab template virtual machine image it will be persisted in this gallery. Shared + images from the gallery can be made available to use when creating new labs. + :type shared_gallery_id: str + :param support_info: Support contact information and instructions for users of the lab plan. + This information is displayed to lab owners and virtual machine users for all labs in the lab + plan. + :type support_info: ~azure.mgmt.labservices.models.SupportInfo + :param linked_lms_instance: Base Url of the lms instance this lab plan can link lab rosters + against. + :type linked_lms_instance: str """ _validation = { - 'private_ip_address': {'readonly': True}, - 'ssh_authority': {'readonly': True}, - 'rdp_authority': {'readonly': True}, - 'username': {'readonly': True}, + 'shared_gallery_id': {'max_length': 2000, 'min_length': 3}, + 'linked_lms_instance': {'max_length': 2000, 'min_length': 3}, } _attribute_map = { - 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, - 'ssh_authority': {'key': 'sshAuthority', 'type': 'str'}, - 'rdp_authority': {'key': 'rdpAuthority', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'default_connection_profile': {'key': 'properties.defaultConnectionProfile', 'type': 'ConnectionProfile'}, + 'default_auto_shutdown_profile': {'key': 'properties.defaultAutoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'default_network_profile': {'key': 'properties.defaultNetworkProfile', 'type': 'LabPlanNetworkProfile'}, + 'allowed_regions': {'key': 'properties.allowedRegions', 'type': '[str]'}, + 'shared_gallery_id': {'key': 'properties.sharedGalleryId', 'type': 'str'}, + 'support_info': {'key': 'properties.supportInfo', 'type': 'SupportInfo'}, + 'linked_lms_instance': {'key': 'properties.linkedLmsInstance', 'type': 'str'}, } def __init__( self, - **kwargs - ): - super(NetworkInterface, self).__init__(**kwargs) - self.private_ip_address = None - self.ssh_authority = None - self.rdp_authority = None - self.username = None - - -class OperationBatchStatusPayload(msrest.serialization.Model): - """Payload to get the status of an operation. - - All required parameters must be populated in order to send to Azure. - - :param urls: Required. The operation url of long running operation. - :type urls: list[str] + *, + tags: Optional[List[str]] = None, + default_connection_profile: Optional["ConnectionProfile"] = None, + default_auto_shutdown_profile: Optional["AutoShutdownProfile"] = None, + default_network_profile: Optional["LabPlanNetworkProfile"] = None, + allowed_regions: Optional[List[str]] = None, + shared_gallery_id: Optional[str] = None, + support_info: Optional["SupportInfo"] = None, + linked_lms_instance: Optional[str] = None, + **kwargs + ): + super(LabPlanUpdate, self).__init__(tags=tags, **kwargs) + self.default_connection_profile = default_connection_profile + self.default_auto_shutdown_profile = default_auto_shutdown_profile + self.default_network_profile = default_network_profile + self.allowed_regions = allowed_regions + self.shared_gallery_id = shared_gallery_id + self.support_info = support_info + self.linked_lms_instance = linked_lms_instance + + +class LabUpdateProperties(msrest.serialization.Model): + """Properties of a lab resource used for updates. + + :param auto_shutdown_profile: The resource auto shutdown configuration for the lab. This + controls whether actions are taken on resources that are sitting idle. + :type auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param connection_profile: The connection profile for the lab. This controls settings such as + web access to lab resources or whether RDP or SSH ports are open. + :type connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param virtual_machine_profile: The profile used for creating lab virtual machines. + :type virtual_machine_profile: ~azure.mgmt.labservices.models.VirtualMachineProfile + :param security_profile: The lab security profile. + :type security_profile: ~azure.mgmt.labservices.models.SecurityProfile + :param roster_profile: The lab user list management profile. + :type roster_profile: ~azure.mgmt.labservices.models.RosterProfile + :param lab_plan_id: The ID of the lab plan. Used during resource creation to provide defaults + and acts as a permission container when creating a lab via labs.azure.com. Setting a labPlanId + on an existing lab provides organization.. + :type lab_plan_id: str + :param title: The title of the lab. + :type title: str + :param description: The description of the lab. + :type description: str """ _validation = { - 'urls': {'required': True}, + 'lab_plan_id': {'max_length': 2000, 'min_length': 3}, + 'title': {'max_length': 120, 'min_length': 1}, } _attribute_map = { - 'urls': {'key': 'urls', 'type': '[str]'}, + 'auto_shutdown_profile': {'key': 'autoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'connection_profile': {'key': 'connectionProfile', 'type': 'ConnectionProfile'}, + 'virtual_machine_profile': {'key': 'virtualMachineProfile', 'type': 'VirtualMachineProfile'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'roster_profile': {'key': 'rosterProfile', 'type': 'RosterProfile'}, + 'lab_plan_id': {'key': 'labPlanId', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, *, - urls: List[str], + auto_shutdown_profile: Optional["AutoShutdownProfile"] = None, + connection_profile: Optional["ConnectionProfile"] = None, + virtual_machine_profile: Optional["VirtualMachineProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + roster_profile: Optional["RosterProfile"] = None, + lab_plan_id: Optional[str] = None, + title: Optional[str] = None, + description: Optional[str] = None, **kwargs ): - super(OperationBatchStatusPayload, self).__init__(**kwargs) - self.urls = urls + super(LabUpdateProperties, self).__init__(**kwargs) + self.auto_shutdown_profile = auto_shutdown_profile + self.connection_profile = connection_profile + self.virtual_machine_profile = virtual_machine_profile + self.security_profile = security_profile + self.roster_profile = roster_profile + self.lab_plan_id = lab_plan_id + self.title = title + self.description = description -class OperationBatchStatusResponse(msrest.serialization.Model): - """Status Details of the long running operation for an environment. +class LabProperties(LabUpdateProperties): + """Properties of a lab resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar items: Gets a collection of items that contain the operation url and status. - :vartype items: list[~azure.mgmt.labservices.models.OperationBatchStatusResponseItem] + :param auto_shutdown_profile: The resource auto shutdown configuration for the lab. This + controls whether actions are taken on resources that are sitting idle. + :type auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param connection_profile: The connection profile for the lab. This controls settings such as + web access to lab resources or whether RDP or SSH ports are open. + :type connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param virtual_machine_profile: The profile used for creating lab virtual machines. + :type virtual_machine_profile: ~azure.mgmt.labservices.models.VirtualMachineProfile + :param security_profile: The lab security profile. + :type security_profile: ~azure.mgmt.labservices.models.SecurityProfile + :param roster_profile: The lab user list management profile. + :type roster_profile: ~azure.mgmt.labservices.models.RosterProfile + :param lab_plan_id: The ID of the lab plan. Used during resource creation to provide defaults + and acts as a permission container when creating a lab via labs.azure.com. Setting a labPlanId + on an existing lab provides organization.. + :type lab_plan_id: str + :param title: The title of the lab. + :type title: str + :param description: The description of the lab. + :type description: str + :ivar provisioning_state: Current provisioning state of the lab. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :param network_profile: The network profile for the lab, typically applied via a lab plan. This + profile cannot be modified once a lab has been created. + :type network_profile: ~azure.mgmt.labservices.models.LabNetworkProfile + :ivar state: The lab state. Possible values include: "Draft", "Publishing", "Scaling", + "Syncing", "Published". + :vartype state: str or ~azure.mgmt.labservices.models.LabState """ _validation = { - 'items': {'readonly': True}, + 'lab_plan_id': {'max_length': 2000, 'min_length': 3}, + 'title': {'max_length': 120, 'min_length': 1}, + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, } _attribute_map = { - 'items': {'key': 'items', 'type': '[OperationBatchStatusResponseItem]'}, + 'auto_shutdown_profile': {'key': 'autoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'connection_profile': {'key': 'connectionProfile', 'type': 'ConnectionProfile'}, + 'virtual_machine_profile': {'key': 'virtualMachineProfile', 'type': 'VirtualMachineProfile'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'roster_profile': {'key': 'rosterProfile', 'type': 'RosterProfile'}, + 'lab_plan_id': {'key': 'labPlanId', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_profile': {'key': 'networkProfile', 'type': 'LabNetworkProfile'}, + 'state': {'key': 'state', 'type': 'str'}, } def __init__( self, + *, + auto_shutdown_profile: Optional["AutoShutdownProfile"] = None, + connection_profile: Optional["ConnectionProfile"] = None, + virtual_machine_profile: Optional["VirtualMachineProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + roster_profile: Optional["RosterProfile"] = None, + lab_plan_id: Optional[str] = None, + title: Optional[str] = None, + description: Optional[str] = None, + network_profile: Optional["LabNetworkProfile"] = None, **kwargs ): - super(OperationBatchStatusResponse, self).__init__(**kwargs) - self.items = None - - -class OperationBatchStatusResponseItem(msrest.serialization.Model): - """Represents the status of an operation that used the batch API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation_url: status of the long running operation for an environment. - :vartype operation_url: str - :ivar status: status of the long running operation for an environment. - :vartype status: str + super(LabProperties, self).__init__(auto_shutdown_profile=auto_shutdown_profile, connection_profile=connection_profile, virtual_machine_profile=virtual_machine_profile, security_profile=security_profile, roster_profile=roster_profile, lab_plan_id=lab_plan_id, title=title, description=description, **kwargs) + self.provisioning_state = None + self.network_profile = network_profile + self.state = None + + +class LabUpdate(TrackedResourceUpdate): + """The lab resource for updates. + + :param tags: A set of tags. Resource tags. + :type tags: list[str] + :param auto_shutdown_profile: The resource auto shutdown configuration for the lab. This + controls whether actions are taken on resources that are sitting idle. + :type auto_shutdown_profile: ~azure.mgmt.labservices.models.AutoShutdownProfile + :param connection_profile: The connection profile for the lab. This controls settings such as + web access to lab resources or whether RDP or SSH ports are open. + :type connection_profile: ~azure.mgmt.labservices.models.ConnectionProfile + :param virtual_machine_profile: The profile used for creating lab virtual machines. + :type virtual_machine_profile: ~azure.mgmt.labservices.models.VirtualMachineProfile + :param security_profile: The lab security profile. + :type security_profile: ~azure.mgmt.labservices.models.SecurityProfile + :param roster_profile: The lab user list management profile. + :type roster_profile: ~azure.mgmt.labservices.models.RosterProfile + :param lab_plan_id: The ID of the lab plan. Used during resource creation to provide defaults + and acts as a permission container when creating a lab via labs.azure.com. Setting a labPlanId + on an existing lab provides organization.. + :type lab_plan_id: str + :param title: The title of the lab. + :type title: str + :param description: The description of the lab. + :type description: str """ _validation = { - 'operation_url': {'readonly': True}, - 'status': {'readonly': True}, + 'lab_plan_id': {'max_length': 2000, 'min_length': 3}, + 'title': {'max_length': 120, 'min_length': 1}, } _attribute_map = { - 'operation_url': {'key': 'operationUrl', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'auto_shutdown_profile': {'key': 'properties.autoShutdownProfile', 'type': 'AutoShutdownProfile'}, + 'connection_profile': {'key': 'properties.connectionProfile', 'type': 'ConnectionProfile'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'roster_profile': {'key': 'properties.rosterProfile', 'type': 'RosterProfile'}, + 'lab_plan_id': {'key': 'properties.labPlanId', 'type': 'str'}, + 'title': {'key': 'properties.title', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, } def __init__( self, + *, + tags: Optional[List[str]] = None, + auto_shutdown_profile: Optional["AutoShutdownProfile"] = None, + connection_profile: Optional["ConnectionProfile"] = None, + virtual_machine_profile: Optional["VirtualMachineProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + roster_profile: Optional["RosterProfile"] = None, + lab_plan_id: Optional[str] = None, + title: Optional[str] = None, + description: Optional[str] = None, **kwargs ): - super(OperationBatchStatusResponseItem, self).__init__(**kwargs) - self.operation_url = None - self.status = None + super(LabUpdate, self).__init__(tags=tags, **kwargs) + self.auto_shutdown_profile = auto_shutdown_profile + self.connection_profile = connection_profile + self.virtual_machine_profile = virtual_machine_profile + self.security_profile = security_profile + self.roster_profile = roster_profile + self.lab_plan_id = lab_plan_id + self.title = title + self.description = description -class OperationError(msrest.serialization.Model): - """Error details for the operation in case of a failure. +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. - :param code: The error code of the operation error. - :type code: str - :param message: The error message of the operation error. - :type message: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. + :type display: ~azure.mgmt.labservices.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.labservices.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.labservices.models.ActionType """ - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, } - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): - super(OperationError, self).__init__(**kwargs) - self.code = code - self.message = message - - -class OperationMetadata(msrest.serialization.Model): - """The REST API operation supported by ManagedLab ResourceProvider. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operations. - :type display: ~azure.mgmt.labservices.models.OperationMetadataDisplay - """ - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationMetadataDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( self, *, - name: Optional[str] = None, - display: Optional["OperationMetadataDisplay"] = None, + display: Optional["OperationDisplay"] = None, **kwargs ): - super(OperationMetadata, self).__init__(**kwargs) - self.name = name + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None self.display = display + self.origin = None + self.action_type = None -class OperationMetadataDisplay(msrest.serialization.Model): - """The object that describes the operations. +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param operation: Operation type: read, write, delete, listKeys/action, etc. - :type operation: str - :param description: Friendly name of the operation. - :type description: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, @@ -1677,353 +1497,351 @@ class OperationMetadataDisplay(msrest.serialization.Model): def __init__( self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): - super(OperationMetadataDisplay, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationResult(msrest.serialization.Model): - """An Operation Result. - - :param status: The operation status. - :type status: str - :param error: Error details for the operation in case of a failure. - :type error: ~azure.mgmt.labservices.models.OperationError - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'OperationError'}, - } - - def __init__( - self, - *, - status: Optional[str] = None, - error: Optional["OperationError"] = None, **kwargs ): - super(OperationResult, self).__init__(**kwargs) - self.status = status - self.error = error + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class OperationStatusPayload(msrest.serialization.Model): - """Payload to get the status of an operation. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param operation_url: Required. The operation url of long running operation. - :type operation_url: str + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.labservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ _validation = { - 'operation_url': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'operation_url': {'key': 'operationUrl', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - operation_url: str, **kwargs ): - super(OperationStatusPayload, self).__init__(**kwargs) - self.operation_url = operation_url + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class OperationStatusResponse(msrest.serialization.Model): - """Status Details of the long running operation for an environment. +class OperationResult(msrest.serialization.Model): + """A long running operation result. Variables are only populated by the server, and will be ignored when sending a request. - :ivar status: status of the long running operation for an environment. - :vartype status: str + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param status: Required. The operation status. Possible values include: "NotStarted", + "InProgress", "Succeeded", "Failed", "Canceled". + :type status: str or ~azure.mgmt.labservices.models.OperationStatus + :param start_time: Start time. + :type start_time: ~datetime.datetime + :param end_time: End time. + :type end_time: ~datetime.datetime + :param percent_complete: Percent completion. + :type percent_complete: float + :param error: The error for a failure if the operation failed. + :type error: ~azure.mgmt.labservices.models.ErrorDetail """ _validation = { - 'status': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'status': {'required': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResponse, self).__init__(**kwargs) - self.status = None - - -class PersonalPreferencesOperationsPayload(msrest.serialization.Model): - """Represents payload for any Environment operations like get, start, stop, connect. - - :param lab_account_resource_id: Resource Id of the lab account. - :type lab_account_resource_id: str - :param add_remove: Enum indicating if user is adding or removing a favorite lab. Possible - values include: "Add", "Remove". - :type add_remove: str or ~azure.mgmt.labservices.models.AddRemove - :param lab_resource_id: Resource Id of the lab to add/remove from the favorites list. - :type lab_resource_id: str - """ - - _attribute_map = { - 'lab_account_resource_id': {'key': 'labAccountResourceId', 'type': 'str'}, - 'add_remove': {'key': 'addRemove', 'type': 'str'}, - 'lab_resource_id': {'key': 'labResourceId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - lab_account_resource_id: Optional[str] = None, - add_remove: Optional[Union[str, "AddRemove"]] = None, - lab_resource_id: Optional[str] = None, + status: Union[str, "OperationStatus"], + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + percent_complete: Optional[float] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): - super(PersonalPreferencesOperationsPayload, self).__init__(**kwargs) - self.lab_account_resource_id = lab_account_resource_id - self.add_remove = add_remove - self.lab_resource_id = lab_resource_id + super(OperationResult, self).__init__(**kwargs) + self.id = None + self.name = None + self.status = status + self.start_time = start_time + self.end_time = end_time + self.percent_complete = percent_complete + self.error = error -class ProviderOperationResult(msrest.serialization.Model): - """Result of the request to list REST API operations. +class PagedImages(msrest.serialization.Model): + """Paged list of Lab services virtual machine images. Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by the resource provider. - :type value: list[~azure.mgmt.labservices.models.OperationMetadata] - :ivar next_link: URL to get the next set of operation list results if there are any. + :ivar value: The array page of virtual machine images. + :vartype value: list[~azure.mgmt.labservices.models.Image] + :ivar next_link: The link to get the next page of image results. :vartype next_link: str """ _validation = { + 'value': {'readonly': True}, 'next_link': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationMetadata]'}, + 'value': {'key': 'value', 'type': '[Image]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - value: Optional[List["OperationMetadata"]] = None, **kwargs ): - super(ProviderOperationResult, self).__init__(**kwargs) - self.value = value + super(PagedImages, self).__init__(**kwargs) + self.value = None self.next_link = None -class PublishPayload(msrest.serialization.Model): - """Payload for Publish operation on EnvironmentSetting. +class PagedLabPlans(msrest.serialization.Model): + """Paged list of lab plans. + + Variables are only populated by the server, and will be ignored when sending a request. - :param use_existing_image: Whether to use existing VM custom image when publishing. - :type use_existing_image: bool + :ivar value: The array page of lab plans. + :vartype value: list[~azure.mgmt.labservices.models.LabPlan] + :ivar next_link: The link to get the next page of lab plan results. + :vartype next_link: str """ + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'use_existing_image': {'key': 'useExistingImage', 'type': 'bool'}, + 'value': {'key': 'value', 'type': '[LabPlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - use_existing_image: Optional[bool] = None, **kwargs ): - super(PublishPayload, self).__init__(**kwargs) - self.use_existing_image = use_existing_image + super(PagedLabPlans, self).__init__(**kwargs) + self.value = None + self.next_link = None -class ReferenceVm(msrest.serialization.Model): - """Details of a Reference Vm. +class PagedLabs(msrest.serialization.Model): + """Paged list of labs. 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. - - :param user_name: Required. The username of the virtual machine. - :type user_name: str - :param password: The password of the virtual machine. This will be set to null in GET resource - API. - :type password: str - :ivar vm_state_details: The state details for the reference virtual machine. - :vartype vm_state_details: ~azure.mgmt.labservices.models.VmStateDetails - :ivar vm_resource_id: VM resource Id for the environment. - :vartype vm_resource_id: str + :ivar value: The array page of lab results. + :vartype value: list[~azure.mgmt.labservices.models.Lab] + :ivar next_link: The link to get the next page of image results. + :vartype next_link: str """ _validation = { - 'user_name': {'required': True}, - 'vm_state_details': {'readonly': True}, - 'vm_resource_id': {'readonly': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'vm_state_details': {'key': 'vmStateDetails', 'type': 'VmStateDetails'}, - 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Lab]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - user_name: str, - password: Optional[str] = None, **kwargs ): - super(ReferenceVm, self).__init__(**kwargs) - self.user_name = user_name - self.password = password - self.vm_state_details = None - self.vm_resource_id = None + super(PagedLabs, self).__init__(**kwargs) + self.value = None + self.next_link = None -class ReferenceVmCreationParameters(msrest.serialization.Model): - """Creation parameters for Reference Vm. +class PagedSchedules(msrest.serialization.Model): + """Paged list of schedules. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param user_name: Required. The username of the virtual machine. - :type user_name: str - :param password: Required. The password of the virtual machine. - :type password: str + :ivar value: The array page of schedule results. + :vartype value: list[~azure.mgmt.labservices.models.Schedule] + :ivar next_link: The link to get the next page of schedule results. + :vartype next_link: str """ _validation = { - 'user_name': {'required': True}, - 'password': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Schedule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - user_name: str, - password: str, **kwargs ): - super(ReferenceVmCreationParameters, self).__init__(**kwargs) - self.user_name = user_name - self.password = password + super(PagedSchedules, self).__init__(**kwargs) + self.value = None + self.next_link = None -class ReferenceVmFragment(msrest.serialization.Model): - """Details of a Reference Vm. +class PagedUsers(msrest.serialization.Model): + """Paged list of users. - :param user_name: The username of the virtual machine. - :type user_name: str - :param password: The password of the virtual machine. This will be set to null in GET resource - API. - :type password: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The array page of user results. + :vartype value: list[~azure.mgmt.labservices.models.User] + :ivar next_link: The link to get the next page of image results. + :vartype next_link: str """ + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[User]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - user_name: Optional[str] = None, - password: Optional[str] = None, **kwargs ): - super(ReferenceVmFragment, self).__init__(**kwargs) - self.user_name = user_name - self.password = password + super(PagedUsers, self).__init__(**kwargs) + self.value = None + self.next_link = None -class RegionalAvailability(msrest.serialization.Model): - """The availability information of sizes across regions. +class PagedVirtualMachines(msrest.serialization.Model): + """Paged list of lab services virtual machines. - :param region: Corresponding region. - :type region: str - :param size_availabilities: List of all the size information for the region. - :type size_availabilities: list[~azure.mgmt.labservices.models.SizeAvailability] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The array page of virtual machine results. + :vartype value: list[~azure.mgmt.labservices.models.VirtualMachine] + :ivar next_link: The link to get the next page of virtual machine results. + :vartype next_link: str """ + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'size_availabilities': {'key': 'sizeAvailabilities', 'type': '[SizeAvailability]'}, + 'value': {'key': 'value', 'type': '[VirtualMachine]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - region: Optional[str] = None, - size_availabilities: Optional[List["SizeAvailability"]] = None, **kwargs ): - super(RegionalAvailability, self).__init__(**kwargs) - self.region = region - self.size_availabilities = size_availabilities + super(PagedVirtualMachines, self).__init__(**kwargs) + self.value = None + self.next_link = None -class RegisterPayload(msrest.serialization.Model): - """Represents payload for Register action. +class RecurrencePattern(msrest.serialization.Model): + """Recurrence pattern of a lab schedule. + + All required parameters must be populated in order to send to Azure. - :param registration_code: The registration code of the lab. - :type registration_code: str + :param frequency: Required. The frequency of the recurrence. Possible values include: "Daily", + "Weekly". + :type frequency: str or ~azure.mgmt.labservices.models.RecurrenceFrequency + :param week_days: The week days the schedule runs. Used for when the Frequency is set to + Weekly. + :type week_days: list[str or ~azure.mgmt.labservices.models.WeekDay] + :param interval: The interval to invoke the schedule on. For example, interval = 2 and + RecurrenceFrequency.Daily will run every 2 days. When no interval is supplied, an interval of 1 + is used. + :type interval: int + :param expiration_date: Required. When the recurrence will expire. This date is inclusive. + :type expiration_date: ~datetime.date """ + _validation = { + 'frequency': {'required': True}, + 'interval': {'maximum': 365, 'minimum': 1}, + 'expiration_date': {'required': True}, + } + _attribute_map = { - 'registration_code': {'key': 'registrationCode', 'type': 'str'}, + 'frequency': {'key': 'frequency', 'type': 'str'}, + 'week_days': {'key': 'weekDays', 'type': '[str]'}, + 'interval': {'key': 'interval', 'type': 'int'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'date'}, } def __init__( self, *, - registration_code: Optional[str] = None, + frequency: Union[str, "RecurrenceFrequency"], + expiration_date: datetime.date, + week_days: Optional[List[Union[str, "WeekDay"]]] = None, + interval: Optional[int] = None, **kwargs ): - super(RegisterPayload, self).__init__(**kwargs) - self.registration_code = registration_code + super(RecurrencePattern, self).__init__(**kwargs) + self.frequency = frequency + self.week_days = week_days + self.interval = interval + self.expiration_date = expiration_date -class ResetPasswordPayload(msrest.serialization.Model): - """Represents the payload for resetting passwords. +class ResetPasswordBody(msrest.serialization.Model): + """Body of a reset password request. All required parameters must be populated in order to send to Azure. - :param environment_id: Required. The resourceId of the environment. - :type environment_id: str - :param username: The username for which the password will be reset. + :param username: Required. The user whose password is being reset. :type username: str - :param password: The password to assign to the user specified in. + :param password: Required. The password. :type password: str """ _validation = { - 'environment_id': {'required': True}, + 'username': {'required': True}, + 'password': {'required': True}, } _attribute_map = { - 'environment_id': {'key': 'environmentId', 'type': 'str'}, 'username': {'key': 'username', 'type': 'str'}, 'password': {'key': 'password', 'type': 'str'}, } @@ -2031,729 +1849,904 @@ class ResetPasswordPayload(msrest.serialization.Model): def __init__( self, *, - environment_id: str, - username: Optional[str] = None, - password: Optional[str] = None, + username: str, + password: str, **kwargs ): - super(ResetPasswordPayload, self).__init__(**kwargs) - self.environment_id = environment_id + super(ResetPasswordBody, self).__init__(**kwargs) self.username = username self.password = password -class ResourceSet(msrest.serialization.Model): - """Represents a VM and the setting Id it was created for. - - :param vm_resource_id: VM resource Id for the environment. - :type vm_resource_id: str - :param resource_setting_id: resourceSettingId for the environment. - :type resource_setting_id: str - """ - - _attribute_map = { - 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, - 'resource_setting_id': {'key': 'resourceSettingId', 'type': 'str'}, - } - - def __init__( - self, - *, - vm_resource_id: Optional[str] = None, - resource_setting_id: Optional[str] = None, - **kwargs - ): - super(ResourceSet, self).__init__(**kwargs) - self.vm_resource_id = vm_resource_id - self.resource_setting_id = resource_setting_id - - -class ResourceSetFragment(msrest.serialization.Model): - """Represents a VM and the setting Id it was created for. +class RosterProfile(msrest.serialization.Model): + """The lab user list management profile. - :param vm_resource_id: VM resource Id for the environment. - :type vm_resource_id: str - :param resource_setting_id: resourceSettingId for the environment. - :type resource_setting_id: str + :param active_directory_group_id: The AAD group ID which this lab roster is populated from. + Having this set enables AAD sync mode. + :type active_directory_group_id: str + :param lti_context_id: The unique context identifier for the lab in the lms. + :type lti_context_id: str + :param lms_instance: The base URI identifying the lms instance. + :type lms_instance: str + :param lti_client_id: The unique id of the azure lab services tool in the lms. + :type lti_client_id: str + :param lti_roster_endpoint: The uri of the names and roles service endpoint on the lms for the + class attached to this lab. + :type lti_roster_endpoint: str """ _attribute_map = { - 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, - 'resource_setting_id': {'key': 'resourceSettingId', 'type': 'str'}, + 'active_directory_group_id': {'key': 'activeDirectoryGroupId', 'type': 'str'}, + 'lti_context_id': {'key': 'ltiContextId', 'type': 'str'}, + 'lms_instance': {'key': 'lmsInstance', 'type': 'str'}, + 'lti_client_id': {'key': 'ltiClientId', 'type': 'str'}, + 'lti_roster_endpoint': {'key': 'ltiRosterEndpoint', 'type': 'str'}, } def __init__( self, *, - vm_resource_id: Optional[str] = None, - resource_setting_id: Optional[str] = None, + active_directory_group_id: Optional[str] = None, + lti_context_id: Optional[str] = None, + lms_instance: Optional[str] = None, + lti_client_id: Optional[str] = None, + lti_roster_endpoint: Optional[str] = None, **kwargs ): - super(ResourceSetFragment, self).__init__(**kwargs) - self.vm_resource_id = vm_resource_id - self.resource_setting_id = resource_setting_id + super(RosterProfile, self).__init__(**kwargs) + self.active_directory_group_id = active_directory_group_id + self.lti_context_id = lti_context_id + self.lms_instance = lms_instance + self.lti_client_id = lti_client_id + self.lti_roster_endpoint = lti_roster_endpoint -class ResourceSettingCreationParameters(msrest.serialization.Model): - """Represents resource specific settings. +class SaveImageBody(msrest.serialization.Model): + """Body for the save image POST. - All required parameters must be populated in order to send to Azure. - - :param location: The location where the virtual machine will live. - :type location: str - :param name: The name of the resource setting. + :param name: The name for the image we create. :type name: str - :param gallery_image_resource_id: Required. The resource id of the gallery image used for - creating the virtual machine. - :type gallery_image_resource_id: str - :param size: The size of the virtual machine. Possible values include: "Basic", "Standard", - "Performance". - :type size: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param reference_vm_creation_parameters: Required. Creation parameters for Reference Vm. - :type reference_vm_creation_parameters: - ~azure.mgmt.labservices.models.ReferenceVmCreationParameters + :param lab_virtual_machine_id: The ID of the lab virtual machine you want to save an image + from. + :type lab_virtual_machine_id: str """ _validation = { - 'gallery_image_resource_id': {'required': True}, - 'reference_vm_creation_parameters': {'required': True}, + 'lab_virtual_machine_id': {'max_length': 2000, 'min_length': 3}, } _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'gallery_image_resource_id': {'key': 'galleryImageResourceId', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'reference_vm_creation_parameters': {'key': 'referenceVmCreationParameters', 'type': 'ReferenceVmCreationParameters'}, + 'lab_virtual_machine_id': {'key': 'labVirtualMachineId', 'type': 'str'}, } def __init__( self, *, - gallery_image_resource_id: str, - reference_vm_creation_parameters: "ReferenceVmCreationParameters", - location: Optional[str] = None, name: Optional[str] = None, - size: Optional[Union[str, "ManagedLabVmSize"]] = None, + lab_virtual_machine_id: Optional[str] = None, **kwargs ): - super(ResourceSettingCreationParameters, self).__init__(**kwargs) - self.location = location + super(SaveImageBody, self).__init__(**kwargs) self.name = name - self.gallery_image_resource_id = gallery_image_resource_id - self.size = size - self.reference_vm_creation_parameters = reference_vm_creation_parameters + self.lab_virtual_machine_id = lab_virtual_machine_id -class ResourceSettings(msrest.serialization.Model): - """Represents resource specific settings. +class Schedule(ProxyResource): + """Schedule for automatically turning virtual machines in a lab on and off at specified times. 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: The unique id of the resource setting. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :param gallery_image_resource_id: The resource id of the gallery image used for creating the - virtual machine. - :type gallery_image_resource_id: str - :ivar image_name: The name of the image used to created the environment setting. - :vartype image_name: str - :param size: The size of the virtual machine. Possible values include: "Basic", "Standard", - "Performance". - :type size: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :ivar cores: The translated compute cores of the virtual machine. - :vartype cores: int - :param reference_vm: Required. Details specific to Reference Vm. - :type reference_vm: ~azure.mgmt.labservices.models.ReferenceVm + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the schedule. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param start_at: When lab user virtual machines will be started. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type start_at: ~datetime.datetime + :param stop_at: When lab user virtual machines will be stopped. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type stop_at: ~datetime.datetime + :param recurrence_pattern: The recurrence pattern of the scheduled actions. + :type recurrence_pattern: ~azure.mgmt.labservices.models.RecurrencePattern + :param time_zone_id: The IANA timezone id for the schedule. + :type time_zone_id: str + :param notes: Notes for this schedule. + :type notes: str + :ivar provisioning_state: Current provisioning state of the schedule. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState """ _validation = { 'id': {'readonly': True}, - 'image_name': {'readonly': True}, - 'cores': {'readonly': True}, - 'reference_vm': {'required': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'time_zone_id': {'max_length': 50, 'min_length': 0}, + 'notes': {'max_length': 1000, 'min_length': 0}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'gallery_image_resource_id': {'key': 'galleryImageResourceId', 'type': 'str'}, - 'image_name': {'key': 'imageName', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'cores': {'key': 'cores', 'type': 'int'}, - 'reference_vm': {'key': 'referenceVm', 'type': 'ReferenceVm'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'start_at': {'key': 'properties.startAt', 'type': 'iso-8601'}, + 'stop_at': {'key': 'properties.stopAt', 'type': 'iso-8601'}, + 'recurrence_pattern': {'key': 'properties.recurrencePattern', 'type': 'RecurrencePattern'}, + 'time_zone_id': {'key': 'properties.timeZoneId', 'type': 'str'}, + 'notes': {'key': 'properties.notes', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, - reference_vm: "ReferenceVm", - gallery_image_resource_id: Optional[str] = None, - size: Optional[Union[str, "ManagedLabVmSize"]] = None, - **kwargs - ): - super(ResourceSettings, self).__init__(**kwargs) - self.id = None - self.gallery_image_resource_id = gallery_image_resource_id - self.image_name = None - self.size = size - self.cores = None - self.reference_vm = reference_vm + start_at: Optional[datetime.datetime] = None, + stop_at: Optional[datetime.datetime] = None, + recurrence_pattern: Optional["RecurrencePattern"] = None, + time_zone_id: Optional[str] = None, + notes: Optional[str] = None, + **kwargs + ): + super(Schedule, self).__init__(**kwargs) + self.system_data = None + self.start_at = start_at + self.stop_at = stop_at + self.recurrence_pattern = recurrence_pattern + self.time_zone_id = time_zone_id + self.notes = notes + self.provisioning_state = None -class ResourceSettingsFragment(msrest.serialization.Model): - """Represents resource specific settings. +class ScheduleUpdateProperties(msrest.serialization.Model): + """Schedule resource properties used for updates. - :param gallery_image_resource_id: The resource id of the gallery image used for creating the - virtual machine. - :type gallery_image_resource_id: str - :param size: The size of the virtual machine. Possible values include: "Basic", "Standard", - "Performance". - :type size: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param reference_vm: Details specific to Reference Vm. - :type reference_vm: ~azure.mgmt.labservices.models.ReferenceVmFragment + :param start_at: When lab user virtual machines will be started. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type start_at: ~datetime.datetime + :param stop_at: When lab user virtual machines will be stopped. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type stop_at: ~datetime.datetime + :param recurrence_pattern: The recurrence pattern of the scheduled actions. + :type recurrence_pattern: ~azure.mgmt.labservices.models.RecurrencePattern + :param time_zone_id: The IANA timezone id for the schedule. + :type time_zone_id: str + :param notes: Notes for this schedule. + :type notes: str """ + _validation = { + 'time_zone_id': {'max_length': 50, 'min_length': 0}, + 'notes': {'max_length': 1000, 'min_length': 0}, + } + _attribute_map = { - 'gallery_image_resource_id': {'key': 'galleryImageResourceId', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'reference_vm': {'key': 'referenceVm', 'type': 'ReferenceVmFragment'}, + 'start_at': {'key': 'startAt', 'type': 'iso-8601'}, + 'stop_at': {'key': 'stopAt', 'type': 'iso-8601'}, + 'recurrence_pattern': {'key': 'recurrencePattern', 'type': 'RecurrencePattern'}, + 'time_zone_id': {'key': 'timeZoneId', 'type': 'str'}, + 'notes': {'key': 'notes', 'type': 'str'}, } def __init__( self, *, - gallery_image_resource_id: Optional[str] = None, - size: Optional[Union[str, "ManagedLabVmSize"]] = None, - reference_vm: Optional["ReferenceVmFragment"] = None, + start_at: Optional[datetime.datetime] = None, + stop_at: Optional[datetime.datetime] = None, + recurrence_pattern: Optional["RecurrencePattern"] = None, + time_zone_id: Optional[str] = None, + notes: Optional[str] = None, **kwargs ): - super(ResourceSettingsFragment, self).__init__(**kwargs) - self.gallery_image_resource_id = gallery_image_resource_id - self.size = size - self.reference_vm = reference_vm + super(ScheduleUpdateProperties, self).__init__(**kwargs) + self.start_at = start_at + self.stop_at = stop_at + self.recurrence_pattern = recurrence_pattern + self.time_zone_id = time_zone_id + self.notes = notes + +class ScheduleProperties(ScheduleUpdateProperties): + """Schedule resource properties. -class ResponseWithContinuationEnvironment(msrest.serialization.Model): - """The response of a list operation. + Variables are only populated by the server, and will be ignored when sending a request. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.Environment] - :param next_link: Link for next set of results. - :type next_link: str + :param start_at: When lab user virtual machines will be started. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type start_at: ~datetime.datetime + :param stop_at: When lab user virtual machines will be stopped. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type stop_at: ~datetime.datetime + :param recurrence_pattern: The recurrence pattern of the scheduled actions. + :type recurrence_pattern: ~azure.mgmt.labservices.models.RecurrencePattern + :param time_zone_id: The IANA timezone id for the schedule. + :type time_zone_id: str + :param notes: Notes for this schedule. + :type notes: str + :ivar provisioning_state: Current provisioning state of the schedule. Possible values include: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState """ + _validation = { + 'time_zone_id': {'max_length': 50, 'min_length': 0}, + 'notes': {'max_length': 1000, 'min_length': 0}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[Environment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'start_at': {'key': 'startAt', 'type': 'iso-8601'}, + 'stop_at': {'key': 'stopAt', 'type': 'iso-8601'}, + 'recurrence_pattern': {'key': 'recurrencePattern', 'type': 'RecurrencePattern'}, + 'time_zone_id': {'key': 'timeZoneId', 'type': 'str'}, + 'notes': {'key': 'notes', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["Environment"]] = None, - next_link: Optional[str] = None, + start_at: Optional[datetime.datetime] = None, + stop_at: Optional[datetime.datetime] = None, + recurrence_pattern: Optional["RecurrencePattern"] = None, + time_zone_id: Optional[str] = None, + notes: Optional[str] = None, **kwargs ): - super(ResponseWithContinuationEnvironment, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(ScheduleProperties, self).__init__(start_at=start_at, stop_at=stop_at, recurrence_pattern=recurrence_pattern, time_zone_id=time_zone_id, notes=notes, **kwargs) + self.provisioning_state = None -class ResponseWithContinuationEnvironmentSetting(msrest.serialization.Model): - """The response of a list operation. +class ScheduleUpdate(msrest.serialization.Model): + """Schedule for automatically turning virtual machines in a lab on and off at specified times. Used for updates. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.EnvironmentSetting] - :param next_link: Link for next set of results. - :type next_link: str + :param start_at: When lab user virtual machines will be started. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type start_at: ~datetime.datetime + :param stop_at: When lab user virtual machines will be stopped. Timestamp offsets will be + ignored and timeZoneId is used instead. + :type stop_at: ~datetime.datetime + :param recurrence_pattern: The recurrence pattern of the scheduled actions. + :type recurrence_pattern: ~azure.mgmt.labservices.models.RecurrencePattern + :param time_zone_id: The IANA timezone id for the schedule. + :type time_zone_id: str + :param notes: Notes for this schedule. + :type notes: str """ + _validation = { + 'time_zone_id': {'max_length': 50, 'min_length': 0}, + 'notes': {'max_length': 1000, 'min_length': 0}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[EnvironmentSetting]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'start_at': {'key': 'properties.startAt', 'type': 'iso-8601'}, + 'stop_at': {'key': 'properties.stopAt', 'type': 'iso-8601'}, + 'recurrence_pattern': {'key': 'properties.recurrencePattern', 'type': 'RecurrencePattern'}, + 'time_zone_id': {'key': 'properties.timeZoneId', 'type': 'str'}, + 'notes': {'key': 'properties.notes', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["EnvironmentSetting"]] = None, - next_link: Optional[str] = None, + start_at: Optional[datetime.datetime] = None, + stop_at: Optional[datetime.datetime] = None, + recurrence_pattern: Optional["RecurrencePattern"] = None, + time_zone_id: Optional[str] = None, + notes: Optional[str] = None, **kwargs ): - super(ResponseWithContinuationEnvironmentSetting, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(ScheduleUpdate, self).__init__(**kwargs) + self.start_at = start_at + self.stop_at = stop_at + self.recurrence_pattern = recurrence_pattern + self.time_zone_id = time_zone_id + self.notes = notes -class ResponseWithContinuationGalleryImage(msrest.serialization.Model): - """The response of a list operation. +class SecurityProfile(msrest.serialization.Model): + """The lab security profile. + + Variables are only populated by the server, and will be ignored when sending a request. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.GalleryImage] - :param next_link: Link for next set of results. - :type next_link: str + :ivar registration_code: The registration code for the lab. + :vartype registration_code: str + :param open_access: Whether any user or only specified users can register to a lab. Possible + values include: "Enabled", "Disabled". + :type open_access: str or ~azure.mgmt.labservices.models.EnableState """ + _validation = { + 'registration_code': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[GalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'registration_code': {'key': 'registrationCode', 'type': 'str'}, + 'open_access': {'key': 'openAccess', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["GalleryImage"]] = None, - next_link: Optional[str] = None, + open_access: Optional[Union[str, "EnableState"]] = None, **kwargs ): - super(ResponseWithContinuationGalleryImage, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(SecurityProfile, self).__init__(**kwargs) + self.registration_code = None + self.open_access = open_access + +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. -class ResponseWithContinuationLab(msrest.serialization.Model): - """The response of a list operation. + All required parameters must be populated in order to send to Azure. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.Lab] - :param next_link: Link for next set of results. - :type next_link: str + :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :type name: str + :param tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.labservices.models.SkuTier + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int """ + _validation = { + 'name': {'required': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[Lab]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, } def __init__( self, *, - value: Optional[List["Lab"]] = None, - next_link: Optional[str] = None, + name: str, + tier: Optional[Union[str, "SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, **kwargs ): - super(ResponseWithContinuationLab, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity -class ResponseWithContinuationLabAccount(msrest.serialization.Model): - """The response of a list operation. +class SupportInfo(msrest.serialization.Model): + """Support contact information and instructions. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.LabAccount] - :param next_link: Link for next set of results. - :type next_link: str + :param url: Support web address. + :type url: str + :param email: Support contact email address. + :type email: str + :param phone: Support contact phone number. + :type phone: str + :param instructions: Support instructions. + :type instructions: str """ + _validation = { + 'url': {'max_length': 2000, 'min_length': 3}, + 'email': {'max_length': 254, 'min_length': 6}, + 'phone': {'max_length': 31, 'min_length': 1}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[LabAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'instructions': {'key': 'instructions', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["LabAccount"]] = None, - next_link: Optional[str] = None, + url: Optional[str] = None, + email: Optional[str] = None, + phone: Optional[str] = None, + instructions: Optional[str] = None, **kwargs ): - super(ResponseWithContinuationLabAccount, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(SupportInfo, self).__init__(**kwargs) + self.url = url + self.email = email + self.phone = phone + self.instructions = instructions -class ResponseWithContinuationUser(msrest.serialization.Model): - """The response of a list operation. +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. - :param value: Results of the list operation. - :type value: list[~azure.mgmt.labservices.models.User] - :param next_link: Link for next set of results. - :type next_link: str + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.labservices.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.labservices.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ _attribute_map = { - 'value': {'key': 'value', 'type': '[User]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + '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, *, - value: Optional[List["User"]] = None, - next_link: Optional[str] = None, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, **kwargs ): - super(ResponseWithContinuationUser, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + +class User(ProxyResource): + """User of a lab that can register for and use virtual machines within the lab. + + Variables are only populated by the server, and will be ignored when sending a request. -class SizeAvailability(msrest.serialization.Model): - """Represents the size information. + All required parameters must be populated in order to send to Azure. - :param size_category: The category of the size (Basic, Standard, Performance). Possible values - include: "Basic", "Standard", "Performance". - :type size_category: str or ~azure.mgmt.labservices.models.ManagedLabVmSize - :param is_available: Whether or not this size category is available. - :type is_available: bool + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the user resource. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :param additional_usage_quota: The amount of usage quota time the user gets in addition to the + lab usage quota. + :type additional_usage_quota: ~datetime.timedelta + :ivar provisioning_state: Current provisioning state of the user resource. Possible values + include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar display_name: Display name of the user, for example user's full name. + :vartype display_name: str + :param email: Required. Email address of the user. + :type email: str + :ivar registration_state: State of the user's registration within the lab. Possible values + include: "Registered", "NotRegistered". + :vartype registration_state: str or ~azure.mgmt.labservices.models.RegistrationState + :ivar invitation_state: State of the invitation message for the user. Possible values include: + "NotSent", "Sending", "Sent", "Failed". + :vartype invitation_state: str or ~azure.mgmt.labservices.models.InvitationState + :ivar invitation_sent: Date and time when the invitation message was sent to the user. + :vartype invitation_sent: ~datetime.datetime + :ivar total_usage: How long the user has used their virtual machines in this lab. + :vartype total_usage: ~datetime.timedelta """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'display_name': {'readonly': True}, + 'email': {'required': True, 'max_length': 254, 'min_length': 6}, + 'registration_state': {'readonly': True}, + 'invitation_state': {'readonly': True}, + 'invitation_sent': {'readonly': True}, + 'total_usage': {'readonly': True}, + } + _attribute_map = { - 'size_category': {'key': 'sizeCategory', 'type': 'str'}, - 'is_available': {'key': 'isAvailable', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'additional_usage_quota': {'key': 'properties.additionalUsageQuota', 'type': 'duration'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'email': {'key': 'properties.email', 'type': 'str'}, + 'registration_state': {'key': 'properties.registrationState', 'type': 'str'}, + 'invitation_state': {'key': 'properties.invitationState', 'type': 'str'}, + 'invitation_sent': {'key': 'properties.invitationSent', 'type': 'iso-8601'}, + 'total_usage': {'key': 'properties.totalUsage', 'type': 'duration'}, } def __init__( self, *, - size_category: Optional[Union[str, "ManagedLabVmSize"]] = None, - is_available: Optional[bool] = None, + email: str, + additional_usage_quota: Optional[datetime.timedelta] = None, **kwargs ): - super(SizeAvailability, self).__init__(**kwargs) - self.size_category = size_category - self.is_available = is_available + super(User, self).__init__(**kwargs) + self.system_data = None + self.additional_usage_quota = additional_usage_quota + self.provisioning_state = None + self.display_name = None + self.email = email + self.registration_state = None + self.invitation_state = None + self.invitation_sent = None + self.total_usage = None -class SizeConfigurationProperties(msrest.serialization.Model): - """Represents the size configuration under the lab account. +class UserUpdateProperties(msrest.serialization.Model): + """User resource properties used for updates. - :param environment_sizes: Represents a list of size categories supported by this Lab Account - (Small, Medium, Large). - :type environment_sizes: list[~azure.mgmt.labservices.models.EnvironmentSize] + :param additional_usage_quota: The amount of usage quota time the user gets in addition to the + lab usage quota. + :type additional_usage_quota: ~datetime.timedelta """ _attribute_map = { - 'environment_sizes': {'key': 'environmentSizes', 'type': '[EnvironmentSize]'}, + 'additional_usage_quota': {'key': 'additionalUsageQuota', 'type': 'duration'}, } def __init__( self, *, - environment_sizes: Optional[List["EnvironmentSize"]] = None, + additional_usage_quota: Optional[datetime.timedelta] = None, **kwargs ): - super(SizeConfigurationProperties, self).__init__(**kwargs) - self.environment_sizes = environment_sizes + super(UserUpdateProperties, self).__init__(**kwargs) + self.additional_usage_quota = additional_usage_quota -class SizeConfigurationPropertiesFragment(msrest.serialization.Model): - """Represents the size configuration under the lab account. +class UserProperties(UserUpdateProperties): + """User resource properties. - :param environment_sizes: Represents a list of size categories supported by this Lab Account - (Small, Medium, Large). - :type environment_sizes: list[~azure.mgmt.labservices.models.EnvironmentSizeFragment] - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - 'environment_sizes': {'key': 'environmentSizes', 'type': '[EnvironmentSizeFragment]'}, - } + All required parameters must be populated in order to send to Azure. - def __init__( - self, - *, - environment_sizes: Optional[List["EnvironmentSizeFragment"]] = None, - **kwargs - ): - super(SizeConfigurationPropertiesFragment, self).__init__(**kwargs) - self.environment_sizes = environment_sizes - - -class SizeInfo(msrest.serialization.Model): - """Contains detailed information about a size. - - :param compute_size: Represents the actual compute size, e.g. Standard_A2_v2. - :type compute_size: str - :param price: The pay-as-you-go price per hour this size will cost. It does not include - discounts and may not reflect the actual price the size will cost. - :type price: float - :param number_of_cores: The number of cores a VM of this size has. - :type number_of_cores: int - :param memory: The amount of memory available (in GB). - :type memory: float + :param additional_usage_quota: The amount of usage quota time the user gets in addition to the + lab usage quota. + :type additional_usage_quota: ~datetime.timedelta + :ivar provisioning_state: Current provisioning state of the user resource. Possible values + include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar display_name: Display name of the user, for example user's full name. + :vartype display_name: str + :param email: Required. Email address of the user. + :type email: str + :ivar registration_state: State of the user's registration within the lab. Possible values + include: "Registered", "NotRegistered". + :vartype registration_state: str or ~azure.mgmt.labservices.models.RegistrationState + :ivar invitation_state: State of the invitation message for the user. Possible values include: + "NotSent", "Sending", "Sent", "Failed". + :vartype invitation_state: str or ~azure.mgmt.labservices.models.InvitationState + :ivar invitation_sent: Date and time when the invitation message was sent to the user. + :vartype invitation_sent: ~datetime.datetime + :ivar total_usage: How long the user has used their virtual machines in this lab. + :vartype total_usage: ~datetime.timedelta """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'display_name': {'readonly': True}, + 'email': {'required': True, 'max_length': 254, 'min_length': 6}, + 'registration_state': {'readonly': True}, + 'invitation_state': {'readonly': True}, + 'invitation_sent': {'readonly': True}, + 'total_usage': {'readonly': True}, + } + _attribute_map = { - 'compute_size': {'key': 'computeSize', 'type': 'str'}, - 'price': {'key': 'price', 'type': 'float'}, - 'number_of_cores': {'key': 'numberOfCores', 'type': 'int'}, - 'memory': {'key': 'memory', 'type': 'float'}, + 'additional_usage_quota': {'key': 'additionalUsageQuota', 'type': 'duration'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'invitation_state': {'key': 'invitationState', 'type': 'str'}, + 'invitation_sent': {'key': 'invitationSent', 'type': 'iso-8601'}, + 'total_usage': {'key': 'totalUsage', 'type': 'duration'}, } def __init__( self, *, - compute_size: Optional[str] = None, - price: Optional[float] = None, - number_of_cores: Optional[int] = None, - memory: Optional[float] = None, + email: str, + additional_usage_quota: Optional[datetime.timedelta] = None, **kwargs ): - super(SizeInfo, self).__init__(**kwargs) - self.compute_size = compute_size - self.price = price - self.number_of_cores = number_of_cores - self.memory = memory - - -class SizeInfoFragment(msrest.serialization.Model): - """Contains detailed information about a size. - - :param compute_size: Represents the actual compute size, e.g. Standard_A2_v2. - :type compute_size: str - :param price: The pay-as-you-go price per hour this size will cost. It does not include - discounts and may not reflect the actual price the size will cost. - :type price: float - :param number_of_cores: The number of cores a VM of this size has. - :type number_of_cores: int - :param memory: The amount of memory available (in GB). - :type memory: float + super(UserProperties, self).__init__(additional_usage_quota=additional_usage_quota, **kwargs) + self.provisioning_state = None + self.display_name = None + self.email = email + self.registration_state = None + self.invitation_state = None + self.invitation_sent = None + self.total_usage = None + + +class UserUpdate(msrest.serialization.Model): + """User of a lab that can register for and use virtual machines within the lab. Used for updates. + + :param additional_usage_quota: The amount of usage quota time the user gets in addition to the + lab usage quota. + :type additional_usage_quota: ~datetime.timedelta """ _attribute_map = { - 'compute_size': {'key': 'computeSize', 'type': 'str'}, - 'price': {'key': 'price', 'type': 'float'}, - 'number_of_cores': {'key': 'numberOfCores', 'type': 'int'}, - 'memory': {'key': 'memory', 'type': 'float'}, + 'additional_usage_quota': {'key': 'properties.additionalUsageQuota', 'type': 'duration'}, } def __init__( self, *, - compute_size: Optional[str] = None, - price: Optional[float] = None, - number_of_cores: Optional[int] = None, - memory: Optional[float] = None, + additional_usage_quota: Optional[datetime.timedelta] = None, **kwargs ): - super(SizeInfoFragment, self).__init__(**kwargs) - self.compute_size = compute_size - self.price = price - self.number_of_cores = number_of_cores - self.memory = memory + super(UserUpdate, self).__init__(**kwargs) + self.additional_usage_quota = additional_usage_quota -class User(Resource): - """The User registered to a lab. +class VirtualMachine(ProxyResource): + """A lab virtual machine resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The identifier of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :ivar email: The user email address, as it was specified during registration. - :vartype email: str - :ivar family_name: The user family name, as it was specified during registration. - :vartype family_name: str - :ivar given_name: The user given name, as it was specified during registration. - :vartype given_name: str - :ivar tenant_id: The user tenant ID, as it was specified during registration. - :vartype tenant_id: str - :ivar total_usage: How long the user has used his VMs in this lab. - :vartype total_usage: ~datetime.timedelta - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str - :ivar latest_operation_result: The details of the latest operation. ex: status, error. - :vartype latest_operation_result: ~azure.mgmt.labservices.models.LatestOperationResult + :ivar system_data: System data of the Lab virtual machine. + :vartype system_data: ~azure.mgmt.labservices.models.SystemData + :ivar provisioning_state: Current provisioning state of the virtual machine. Possible values + include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Locked". + :vartype provisioning_state: str or ~azure.mgmt.labservices.models.ProvisioningState + :ivar state: The current state of the virtual machine. Possible values include: "Stopped", + "Starting", "Running", "Stopping", "ResettingPassword", "Reimaging", "Redeploying". + :vartype state: str or ~azure.mgmt.labservices.models.VirtualMachineState + :ivar connection_profile: Profile for information about connecting to the virtual machine. + :vartype connection_profile: ~azure.mgmt.labservices.models.VirtualMachineConnectionProfile + :ivar claimed_by_user_id: The lab user ID (not the PUID!) of who claimed the virtual machine. + :vartype claimed_by_user_id: str + :ivar vm_type: The type of this VM resource. Possible values include: "User", "Template". + :vartype vm_type: str or ~azure.mgmt.labservices.models.VirtualMachineType """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'email': {'readonly': True}, - 'family_name': {'readonly': True}, - 'given_name': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'total_usage': {'readonly': True}, - 'latest_operation_result': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'connection_profile': {'readonly': True}, + 'claimed_by_user_id': {'readonly': True}, + 'vm_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}'}, - 'email': {'key': 'properties.email', 'type': 'str'}, - 'family_name': {'key': 'properties.familyName', 'type': 'str'}, - 'given_name': {'key': 'properties.givenName', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'total_usage': {'key': 'properties.totalUsage', 'type': 'duration'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, - 'latest_operation_result': {'key': 'properties.latestOperationResult', 'type': 'LatestOperationResult'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'connection_profile': {'key': 'properties.connectionProfile', 'type': 'VirtualMachineConnectionProfile'}, + 'claimed_by_user_id': {'key': 'properties.claimedByUserId', 'type': 'str'}, + 'vm_type': {'key': 'properties.vmType', 'type': 'str'}, } def __init__( self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, **kwargs ): - super(User, self).__init__(location=location, tags=tags, **kwargs) - self.email = None - self.family_name = None - self.given_name = None - self.tenant_id = None - self.total_usage = None - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier - self.latest_operation_result = None - + super(VirtualMachine, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.state = None + self.connection_profile = None + self.claimed_by_user_id = None + self.vm_type = None -class UserFragment(Resource): - """The User registered to a lab. - Variables are only populated by the server, and will be ignored when sending a request. +class VirtualMachineAdditionalCapabilities(msrest.serialization.Model): + """The additional capabilities for a lab VM. - :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 - :param location: The location of the resource. - :type location: str - :param tags: A set of tags. The tags of the resource. - :type tags: dict[str, str] - :param provisioning_state: The provisioning status of the resource. - :type provisioning_state: str - :param unique_identifier: The unique immutable identifier of a resource (Guid). - :type unique_identifier: str + :param install_gpu_drivers: Flag to pre-install dedicated GPU drivers. Possible values include: + "Enabled", "Disabled". + :type install_gpu_drivers: str or ~azure.mgmt.labservices.models.EnableState """ - _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}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'unique_identifier': {'key': 'properties.uniqueIdentifier', 'type': 'str'}, + 'install_gpu_drivers': {'key': 'installGpuDrivers', 'type': 'str'}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - provisioning_state: Optional[str] = None, - unique_identifier: Optional[str] = None, + install_gpu_drivers: Optional[Union[str, "EnableState"]] = None, **kwargs ): - super(UserFragment, self).__init__(location=location, tags=tags, **kwargs) - self.provisioning_state = provisioning_state - self.unique_identifier = unique_identifier + super(VirtualMachineAdditionalCapabilities, self).__init__(**kwargs) + self.install_gpu_drivers = install_gpu_drivers -class VirtualMachineDetails(msrest.serialization.Model): - """Details of the backing virtual machine. +class VirtualMachineConnectionProfile(msrest.serialization.Model): + """The connection information for the virtual machine. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Dtl VM. - :vartype provisioning_state: str - :ivar rdp_authority: Connection information for Windows. - :vartype rdp_authority: str - :ivar ssh_authority: Connection information for Linux. - :vartype ssh_authority: str - :ivar private_ip_address: PrivateIp address of the compute VM. + :ivar private_ip_address: The private IP address of the virtual machine. :vartype private_ip_address: str - :ivar user_name: Compute VM login user name. - :vartype user_name: str - :ivar last_known_power_state: Last known compute power state captured in DTL. - :vartype last_known_power_state: str + :ivar ssh_authority: Port and host name separated by semicolon for connecting via SSH protocol + to the virtual machine. + :vartype ssh_authority: str + :ivar ssh_in_browser_url: URL for connecting via SSH protocol to the virtual machine in + browser. + :vartype ssh_in_browser_url: str + :ivar rdp_authority: Port and host name separated by semicolon for connecting via RDP protocol + to the virtual machine. + :vartype rdp_authority: str + :ivar rdp_in_browser_url: URL for connecting via RDP protocol to the virtual machine in + browser. + :vartype rdp_in_browser_url: str + :ivar admin_username: The username used to log on to the virtual machine as admin. + :vartype admin_username: str + :ivar non_admin_username: The username used to log on to the virtual machine as non-admin, if + one exists. + :vartype non_admin_username: str """ _validation = { - 'provisioning_state': {'readonly': True}, - 'rdp_authority': {'readonly': True}, - 'ssh_authority': {'readonly': True}, 'private_ip_address': {'readonly': True}, - 'user_name': {'readonly': True}, - 'last_known_power_state': {'readonly': True}, + 'ssh_authority': {'readonly': True}, + 'ssh_in_browser_url': {'readonly': True, 'max_length': 2000, 'min_length': 3}, + 'rdp_authority': {'readonly': True}, + 'rdp_in_browser_url': {'readonly': True, 'max_length': 2000, 'min_length': 3}, + 'admin_username': {'readonly': True}, + 'non_admin_username': {'readonly': True}, } _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'rdp_authority': {'key': 'rdpAuthority', 'type': 'str'}, - 'ssh_authority': {'key': 'sshAuthority', 'type': 'str'}, 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, - 'user_name': {'key': 'userName', 'type': 'str'}, - 'last_known_power_state': {'key': 'lastKnownPowerState', 'type': 'str'}, + 'ssh_authority': {'key': 'sshAuthority', 'type': 'str'}, + 'ssh_in_browser_url': {'key': 'sshInBrowserUrl', 'type': 'str'}, + 'rdp_authority': {'key': 'rdpAuthority', 'type': 'str'}, + 'rdp_in_browser_url': {'key': 'rdpInBrowserUrl', 'type': 'str'}, + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'non_admin_username': {'key': 'nonAdminUsername', 'type': 'str'}, } def __init__( self, **kwargs ): - super(VirtualMachineDetails, self).__init__(**kwargs) - self.provisioning_state = None - self.rdp_authority = None - self.ssh_authority = None + super(VirtualMachineConnectionProfile, self).__init__(**kwargs) self.private_ip_address = None - self.user_name = None - self.last_known_power_state = None + self.ssh_authority = None + self.ssh_in_browser_url = None + self.rdp_authority = None + self.rdp_in_browser_url = None + self.admin_username = None + self.non_admin_username = None -class VmStateDetails(msrest.serialization.Model): - """Details about the state of the reference virtual machine. +class VirtualMachineProfile(msrest.serialization.Model): + """The base virtual machine configuration for a lab. Variables are only populated by the server, and will be ignored when sending a request. - :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 power_state: The power state of the reference virtual machine. - :vartype power_state: str - :ivar last_known_power_state: Last known compute power state captured in DTL. - :vartype last_known_power_state: str + All required parameters must be populated in order to send to Azure. + + :param create_option: Required. Indicates what lab virtual machines are created from. Possible + values include: "Image", "TemplateVM". + :type create_option: str or ~azure.mgmt.labservices.models.CreateOption + :param image_reference: Required. The image configuration for lab virtual machines. + :type image_reference: ~azure.mgmt.labservices.models.ImageReference + :ivar os_type: The OS type of the image. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.labservices.models.OsType + :param sku: Required. The SKU for the lab. Defines the type of virtual machines used in the + lab. + :type sku: ~azure.mgmt.labservices.models.Sku + :param additional_capabilities: Additional VM capabilities. + :type additional_capabilities: + ~azure.mgmt.labservices.models.VirtualMachineAdditionalCapabilities + :param usage_quota: Required. The initial quota alloted to each lab user. Must be a time span + between 0 and 9999 hours. + :type usage_quota: ~datetime.timedelta + :param use_shared_password: Enabling this option will use the same password for all user VMs. + Possible values include: "Enabled", "Disabled". + :type use_shared_password: str or ~azure.mgmt.labservices.models.EnableState + :param admin_user: Required. Credentials for the admin user on the VM. + :type admin_user: ~azure.mgmt.labservices.models.Credentials + :param non_admin_user: Credentials for the non-admin user on the VM, if one exists. + :type non_admin_user: ~azure.mgmt.labservices.models.Credentials """ _validation = { - 'rdp_authority': {'readonly': True}, - 'ssh_authority': {'readonly': True}, - 'power_state': {'readonly': True}, - 'last_known_power_state': {'readonly': True}, + 'create_option': {'required': True}, + 'image_reference': {'required': True}, + 'os_type': {'readonly': True}, + 'sku': {'required': True}, + 'usage_quota': {'required': True}, + 'admin_user': {'required': True}, } _attribute_map = { - 'rdp_authority': {'key': 'rdpAuthority', 'type': 'str'}, - 'ssh_authority': {'key': 'sshAuthority', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'str'}, - 'last_known_power_state': {'key': 'lastKnownPowerState', 'type': 'str'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'additional_capabilities': {'key': 'additionalCapabilities', 'type': 'VirtualMachineAdditionalCapabilities'}, + 'usage_quota': {'key': 'usageQuota', 'type': 'duration'}, + 'use_shared_password': {'key': 'useSharedPassword', 'type': 'str'}, + 'admin_user': {'key': 'adminUser', 'type': 'Credentials'}, + 'non_admin_user': {'key': 'nonAdminUser', 'type': 'Credentials'}, } def __init__( self, - **kwargs - ): - super(VmStateDetails, self).__init__(**kwargs) - self.rdp_authority = None - self.ssh_authority = None - self.power_state = None - self.last_known_power_state = None + *, + create_option: Union[str, "CreateOption"], + image_reference: "ImageReference", + sku: "Sku", + usage_quota: datetime.timedelta, + admin_user: "Credentials", + additional_capabilities: Optional["VirtualMachineAdditionalCapabilities"] = None, + use_shared_password: Optional[Union[str, "EnableState"]] = None, + non_admin_user: Optional["Credentials"] = None, + **kwargs + ): + super(VirtualMachineProfile, self).__init__(**kwargs) + self.create_option = create_option + self.image_reference = image_reference + self.os_type = None + self.sku = sku + self.additional_capabilities = additional_capabilities + self.usage_quota = usage_quota + self.use_shared_password = use_shared_password + self.admin_user = admin_user + self.non_admin_user = non_admin_user diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/__init__.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/__init__.py index bfdfe669911b..1ae701f1d369 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/__init__.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/__init__.py @@ -6,24 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._provider_operations_operations import ProviderOperationsOperations -from ._global_users_operations import GlobalUsersOperations -from ._lab_accounts_operations import LabAccountsOperations from ._operations import Operations -from ._gallery_images_operations import GalleryImagesOperations +from ._operation_results_operations import OperationResultsOperations +from ._lab_plans_operations import LabPlansOperations +from ._images_operations import ImagesOperations from ._labs_operations import LabsOperations -from ._environment_settings_operations import EnvironmentSettingsOperations -from ._environments_operations import EnvironmentsOperations from ._users_operations import UsersOperations +from ._virtual_machines_operations import VirtualMachinesOperations +from ._schedules_operations import SchedulesOperations __all__ = [ - 'ProviderOperationsOperations', - 'GlobalUsersOperations', - 'LabAccountsOperations', 'Operations', - 'GalleryImagesOperations', + 'OperationResultsOperations', + 'LabPlansOperations', + 'ImagesOperations', 'LabsOperations', - 'EnvironmentSettingsOperations', - 'EnvironmentsOperations', 'UsersOperations', + 'VirtualMachinesOperations', + 'SchedulesOperations', ] diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_environments_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_environments_operations.py deleted file mode 100644 index 67cd96bf41f0..000000000000 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_environments_operations.py +++ /dev/null @@ -1,993 +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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class EnvironmentsOperations(object): - """EnvironmentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.labservices.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - expand=None, # type: Optional[str] - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResponseWithContinuationEnvironment"] - """List environments in a given environment setting. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param expand: Specify the $expand query. Example: 'properties($expand=networkInterface)'. - :type expand: str - :param filter: The filter to apply to the operation. - :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationEnvironment or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationEnvironment] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationEnvironment"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationEnvironment', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments'} # type: ignore - - def get( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Environment" - """Get environment. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :param expand: Specify the $expand query. Example: 'properties($expand=networkInterface)'. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Environment, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.Environment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Environment"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Environment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - def create_or_update( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - environment, # type: "_models.Environment" - **kwargs # type: Any - ): - # type: (...) -> "_models.Environment" - """Create or replace an existing Environment. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :param environment: Represents an environment instance. - :type environment: ~azure.mgmt.labservices.models.Environment - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Environment, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.Environment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Environment"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment, 'Environment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Environment', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Environment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [202, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Delete environment. This operation can take a while to complete. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - lab_account_name=lab_account_name, - lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_name=environment_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - def update( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - environment, # type: "_models.EnvironmentFragment" - **kwargs # type: Any - ): - # type: (...) -> "_models.Environment" - """Modify properties of environments. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :param environment: Represents an environment instance. - :type environment: ~azure.mgmt.labservices.models.EnvironmentFragment - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Environment, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.Environment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Environment"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment, 'EnvironmentFragment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Environment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'} # type: ignore - - def claim( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Claims the environment and assigns it to the user. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.claim.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - claim.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/claim'} # type: ignore - - def _reset_password_initial( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - reset_password_payload, # type: "_models.ResetPasswordPayload" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reset_password_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(reset_password_payload, 'ResetPasswordPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _reset_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/resetPassword'} # type: ignore - - def begin_reset_password( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - reset_password_payload, # type: "_models.ResetPasswordPayload" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Resets the user password on an environment This operation can take a while to complete. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_name: str - :param reset_password_payload: Represents the payload for resetting passwords. - :type reset_password_payload: ~azure.mgmt.labservices.models.ResetPasswordPayload - :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._reset_password_initial( - resource_group_name=resource_group_name, - lab_account_name=lab_account_name, - lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_name=environment_name, - reset_password_payload=reset_password_payload, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/resetPassword'} # type: ignore - - def _start_initial( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/start'} # type: ignore - - def begin_start( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Starts an environment by starting all resources inside the environment. This operation can take - a while to complete. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - lab_account_name=lab_account_name, - lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_name=environment_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/start'} # type: ignore - - def _stop_initial( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/stop'} # type: ignore - - def begin_stop( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str - environment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Stops an environment by stopping all resources inside the environment This operation can take a - while to complete. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_name: The name of the environment. - :type environment_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - lab_account_name=lab_account_name, - lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_name=environment_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - 'environmentName': self._serialize.url("environment_name", environment_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/stop'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_global_users_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_global_users_operations.py deleted file mode 100644 index ba694519a39f..000000000000 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_global_users_operations.py +++ /dev/null @@ -1,814 +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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class GlobalUsersOperations(object): - """GlobalUsersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.labservices.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get_environment( - self, - user_name, # type: str - environment_operations_payload, # type: "_models.EnvironmentOperationsPayload" - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.GetEnvironmentResponse" - """Gets the virtual machine details. - - :param user_name: The name of the user. - :type user_name: str - :param environment_operations_payload: Represents payload for any Environment operations like - get, start, stop, connect. - :type environment_operations_payload: ~azure.mgmt.labservices.models.EnvironmentOperationsPayload - :param expand: Specify the $expand query. Example: 'properties($expand=environment)'. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GetEnvironmentResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.GetEnvironmentResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GetEnvironmentResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_operations_payload, 'EnvironmentOperationsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GetEnvironmentResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_environment.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/getEnvironment'} # type: ignore - - def get_operation_batch_status( - self, - user_name, # type: str - operation_batch_status_payload, # type: "_models.OperationBatchStatusPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationBatchStatusResponse" - """Get batch operation status. - - :param user_name: The name of the user. - :type user_name: str - :param operation_batch_status_payload: Payload to get the status of an operation. - :type operation_batch_status_payload: ~azure.mgmt.labservices.models.OperationBatchStatusPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationBatchStatusResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.OperationBatchStatusResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationBatchStatusResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_operation_batch_status.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(operation_batch_status_payload, 'OperationBatchStatusPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('OperationBatchStatusResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_operation_batch_status.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/getOperationBatchStatus'} # type: ignore - - def get_operation_status( - self, - user_name, # type: str - operation_status_payload, # type: "_models.OperationStatusPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResponse" - """Gets the status of long running operation. - - :param user_name: The name of the user. - :type user_name: str - :param operation_status_payload: Payload to get the status of an operation. - :type operation_status_payload: ~azure.mgmt.labservices.models.OperationStatusPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatusResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.OperationStatusResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(operation_status_payload, 'OperationStatusPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('OperationStatusResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_operation_status.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/getOperationStatus'} # type: ignore - - def get_personal_preferences( - self, - user_name, # type: str - personal_preferences_operations_payload, # type: "_models.PersonalPreferencesOperationsPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.GetPersonalPreferencesResponse" - """Get personal preferences for a user. - - :param user_name: The name of the user. - :type user_name: str - :param personal_preferences_operations_payload: Represents payload for any Environment - operations like get, start, stop, connect. - :type personal_preferences_operations_payload: ~azure.mgmt.labservices.models.PersonalPreferencesOperationsPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GetPersonalPreferencesResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.GetPersonalPreferencesResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GetPersonalPreferencesResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_personal_preferences.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(personal_preferences_operations_payload, 'PersonalPreferencesOperationsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GetPersonalPreferencesResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_personal_preferences.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/getPersonalPreferences'} # type: ignore - - def list_environments( - self, - user_name, # type: str - list_environments_payload, # type: "_models.ListEnvironmentsPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.ListEnvironmentsResponse" - """List Environments for the user. - - :param user_name: The name of the user. - :type user_name: str - :param list_environments_payload: Represents the payload to list environments owned by a user. - :type list_environments_payload: ~azure.mgmt.labservices.models.ListEnvironmentsPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListEnvironmentsResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.ListEnvironmentsResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListEnvironmentsResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_environments.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(list_environments_payload, 'ListEnvironmentsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ListEnvironmentsResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_environments.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/listEnvironments'} # type: ignore - - def list_labs( - self, - user_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListLabsResponse" - """List labs for the user. - - :param user_name: The name of the user. - :type user_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListLabsResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.ListLabsResponse - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListLabsResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.list_labs.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ListLabsResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_labs.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/listLabs'} # type: ignore - - def register( - self, - user_name, # type: str - register_payload, # type: "_models.RegisterPayload" - **kwargs # type: Any - ): - # type: (...) -> None - """Register a user to a managed lab. - - :param user_name: The name of the user. - :type user_name: str - :param register_payload: Represents payload for Register action. - :type register_payload: ~azure.mgmt.labservices.models.RegisterPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.register.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(register_payload, 'RegisterPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - register.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/register'} # type: ignore - - def _reset_password_initial( - self, - user_name, # type: str - reset_password_payload, # type: "_models.ResetPasswordPayload" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reset_password_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(reset_password_payload, 'ResetPasswordPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _reset_password_initial.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/resetPassword'} # type: ignore - - def begin_reset_password( - self, - user_name, # type: str - reset_password_payload, # type: "_models.ResetPasswordPayload" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Resets the user password on an environment This operation can take a while to complete. - - :param user_name: The name of the user. - :type user_name: str - :param reset_password_payload: Represents the payload for resetting passwords. - :type reset_password_payload: ~azure.mgmt.labservices.models.ResetPasswordPayload - :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._reset_password_initial( - user_name=user_name, - reset_password_payload=reset_password_payload, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_password.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/resetPassword'} # type: ignore - - def _start_environment_initial( - self, - user_name, # type: str - environment_operations_payload, # type: "_models.EnvironmentOperationsPayload" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._start_environment_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_operations_payload, 'EnvironmentOperationsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _start_environment_initial.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/startEnvironment'} # type: ignore - - def begin_start_environment( - self, - user_name, # type: str - environment_operations_payload, # type: "_models.EnvironmentOperationsPayload" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Starts an environment by starting all resources inside the environment. This operation can take - a while to complete. - - :param user_name: The name of the user. - :type user_name: str - :param environment_operations_payload: Represents payload for any Environment operations like - get, start, stop, connect. - :type environment_operations_payload: ~azure.mgmt.labservices.models.EnvironmentOperationsPayload - :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._start_environment_initial( - user_name=user_name, - environment_operations_payload=environment_operations_payload, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_environment.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/startEnvironment'} # type: ignore - - def _stop_environment_initial( - self, - user_name, # type: str - environment_operations_payload, # type: "_models.EnvironmentOperationsPayload" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._stop_environment_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_operations_payload, 'EnvironmentOperationsPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - 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, {}) - - _stop_environment_initial.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/stopEnvironment'} # type: ignore - - def begin_stop_environment( - self, - user_name, # type: str - environment_operations_payload, # type: "_models.EnvironmentOperationsPayload" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Stops an environment by stopping all resources inside the environment This operation can take a - while to complete. - - :param user_name: The name of the user. - :type user_name: str - :param environment_operations_payload: Represents payload for any Environment operations like - get, start, stop, connect. - :type environment_operations_payload: ~azure.mgmt.labservices.models.EnvironmentOperationsPayload - :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._stop_environment_initial( - user_name=user_name, - environment_operations_payload=environment_operations_payload, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'userName': self._serialize.url("user_name", user_name, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop_environment.metadata = {'url': '/providers/Microsoft.LabServices/users/{userName}/stopEnvironment'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_gallery_images_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_images_operations.py similarity index 54% rename from sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_gallery_images_operations.py rename to sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_images_operations.py index 3b639e9c283a..916eeb0bc8b0 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_gallery_images_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_images_operations.py @@ -18,13 +18,13 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class GalleryImagesOperations(object): - """GalleryImagesOperations operations. +class ImagesOperations(object): + """ImagesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -45,42 +45,36 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def list( + def list_by_lab_plan( self, resource_group_name, # type: str - lab_account_name, # type: str - expand=None, # type: Optional[str] + lab_plan_name, # type: str filter=None, # type: Optional[str] - top=None, # type: Optional[int] - orderby=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.ResponseWithContinuationGalleryImage"] - """List gallery images in a given lab account. + # type: (...) -> Iterable["_models.PagedImages"] + """Gets all images. - :param resource_group_name: The name of the resource group. + Gets all images from galleries attached to a lab plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param expand: Specify the $expand query. Example: 'properties($select=author)'. - :type expand: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationGalleryImage or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationGalleryImage] + :return: An iterator like instance of either PagedImages or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.PagedImages] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationGalleryImage"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedImages"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -90,24 +84,18 @@ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] # type: ignore + url = self.list_by_lab_plan.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -117,7 +105,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationGalleryImage', pipeline_response) + deserialized = self._deserialize('PagedImages', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,62 +118,61 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages'} # type: ignore + list_by_lab_plan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images'} # type: ignore def get( self, resource_group_name, # type: str - lab_account_name, # type: str - gallery_image_name, # type: str - expand=None, # type: Optional[str] + lab_plan_name, # type: str + image_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.GalleryImage" - """Get gallery image. + # type: (...) -> "_models.Image" + """Gets an image. - :param resource_group_name: The name of the resource group. + Gets an image resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param gallery_image_name: The name of the gallery Image. - :type gallery_image_name: str - :param expand: Specify the $expand query. Example: 'properties($select=author)'. - :type expand: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param image_name: The image name. + :type image_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.labservices.models.GalleryImage + :return: Image, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.Image :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + 'imageName': self._serialize.url("image_name", image_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -198,56 +185,60 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('GalleryImage', pipeline_response) + deserialized = self._deserialize('Image', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}'} # type: ignore def create_or_update( self, resource_group_name, # type: str - lab_account_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImage" + lab_plan_name, # type: str + image_name, # type: str + body, # type: "_models.Image" **kwargs # type: Any ): - # type: (...) -> "_models.GalleryImage" - """Create or replace an existing Gallery Image. + # type: (...) -> "_models.Image" + """Updates an image via PUT. + + Updates an image resource via PUT. Creating new resources via PUT will not function. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param gallery_image_name: The name of the gallery Image. - :type gallery_image_name: str - :param gallery_image: Represents an image from the Azure Marketplace. - :type gallery_image: ~azure.mgmt.labservices.models.GalleryImage + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param image_name: The image name. + :type image_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.Image :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.labservices.models.GalleryImage + :return: Image, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.Image :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + 'imageName': self._serialize.url("image_name", image_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -261,128 +252,68 @@ def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImage') + body_content = self._serialize.body(body, 'Image') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('GalleryImage', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('GalleryImage', pipeline_response) + deserialized = self._deserialize('Image', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'} # type: ignore - - def delete( - self, - resource_group_name, # type: str - lab_account_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Delete gallery image. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param gallery_image_name: The name of the gallery Image. - :type gallery_image_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'} # type: ignore + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}'} # type: ignore def update( self, resource_group_name, # type: str - lab_account_name, # type: str - gallery_image_name, # type: str - gallery_image, # type: "_models.GalleryImageFragment" + lab_plan_name, # type: str + image_name, # type: str + body, # type: "_models.ImageUpdate" **kwargs # type: Any ): - # type: (...) -> "_models.GalleryImage" - """Modify properties of gallery images. + # type: (...) -> "_models.Image" + """Updates an image. + + Updates an image resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param gallery_image_name: The name of the gallery Image. - :type gallery_image_name: str - :param gallery_image: Represents an image from the Azure Marketplace. - :type gallery_image: ~azure.mgmt.labservices.models.GalleryImageFragment + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param image_name: The image name. + :type image_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.ImageUpdate :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.labservices.models.GalleryImage + :return: Image, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.Image :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'galleryImageName': self._serialize.url("gallery_image_name", gallery_image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + 'imageName': self._serialize.url("image_name", image_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -396,7 +327,7 @@ def update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gallery_image, 'GalleryImageFragment') + body_content = self._serialize.body(body, 'ImageUpdate') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -404,12 +335,13 @@ def update( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('GalleryImage', pipeline_response) + deserialized = self._deserialize('Image', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_lab_accounts_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_lab_plans_operations.py similarity index 51% rename from sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_lab_accounts_operations.py rename to sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_lab_plans_operations.py index f2ccd78178b2..a7a41df326c5 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_lab_accounts_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_lab_plans_operations.py @@ -25,8 +25,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class LabAccountsOperations(object): - """LabAccountsOperations operations. +class LabPlansOperations(object): + """LabPlansOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -49,34 +49,27 @@ def __init__(self, client, config, serializer, deserializer): def list_by_subscription( self, - expand=None, # type: Optional[str] filter=None, # type: Optional[str] - top=None, # type: Optional[int] - orderby=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.ResponseWithContinuationLabAccount"] - """List lab accounts in a subscription. + # type: (...) -> Iterable["_models.PagedLabPlans"] + """Get all lab plans for a subscription. + + Returns a list of all lab plans within a subscription. - :param expand: Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'. - :type expand: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationLabAccount or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationLabAccount] + :return: An iterator like instance of either PagedLabPlans or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.PagedLabPlans] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationLabAccount"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedLabPlans"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -88,20 +81,14 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -111,7 +98,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationLabAccount', pipeline_response) + deserialized = self._deserialize('PagedLabPlans', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,49 +111,40 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labaccounts'} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labPlans'} # type: ignore def list_by_resource_group( self, resource_group_name, # type: str - expand=None, # type: Optional[str] - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - orderby=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.ResponseWithContinuationLabAccount"] - """List lab accounts in a resource group. + # type: (...) -> Iterable["_models.PagedLabPlans"] + """Get all lab plans for a subscription and resource group. - :param resource_group_name: The name of the resource group. + Returns a list of all lab plans for a subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param expand: Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'. - :type expand: str - :param filter: The filter to apply to the operation. - :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationLabAccount or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationLabAccount] + :return: An iterator like instance of either PagedLabPlans or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.PagedLabPlans] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationLabAccount"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedLabPlans"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -178,20 +156,12 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) @@ -202,7 +172,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationLabAccount', pipeline_response) + deserialized = self._deserialize('PagedLabPlans', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -215,58 +185,57 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans'} # type: ignore def get( self, resource_group_name, # type: str - lab_account_name, # type: str - expand=None, # type: Optional[str] + lab_plan_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.LabAccount" - """Get lab account. + # type: (...) -> "_models.LabPlan" + """Retrieves a Lab Plan resource. + + Retrieves the properties of a Lab Plan. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param expand: Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'. - :type expand: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabAccount, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.LabAccount + :return: LabPlan, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.LabPlan :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LabAccount"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -279,52 +248,40 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('LabAccount', pipeline_response) + deserialized = self._deserialize('LabPlan', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - def create_or_update( + def _create_or_update_initial( self, resource_group_name, # type: str - lab_account_name, # type: str - lab_account, # type: "_models.LabAccount" + lab_plan_name, # type: str + body, # type: "_models.LabPlan" **kwargs # type: Any ): - # type: (...) -> "_models.LabAccount" - """Create or replace an existing Lab Account. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_account: Represents a lab account. - :type lab_account: ~azure.mgmt.labservices.models.LabAccount - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabAccount, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.LabAccount - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LabAccount"] + # type: (...) -> "_models.LabPlan" + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -338,49 +295,130 @@ def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(lab_account, 'LabAccount') + body_content = self._serialize.body(body, 'LabPlan') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('LabAccount', pipeline_response) + deserialized = self._deserialize('LabPlan', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('LabAccount', pipeline_response) + deserialized = self._deserialize('LabPlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('LabPlan', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - def _delete_initial( + def begin_create_or_update( self, resource_group_name, # type: str - lab_account_name, # type: str + lab_plan_name, # type: str + body, # type: "_models.LabPlan" **kwargs # type: Any ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + # type: (...) -> LROPoller["_models.LabPlan"] + """Updates or creates a Lab Plan resource. + + Operation to create or update a Lab Plan resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.LabPlan + :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 LabPlan or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.labservices.models.LabPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_plan_name=lab_plan_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LabPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + lab_plan_name, # type: str + body, # type: "_models.LabPlanUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.LabPlan" + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -390,55 +428,74 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'LabPlanUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LabPlan', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('LabPlan', pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - def begin_delete( + def begin_update( self, resource_group_name, # type: str - lab_account_name, # type: str + lab_plan_name, # type: str + body, # type: "_models.LabPlanUpdate" **kwargs # type: Any ): - # type: (...) -> LROPoller[None] - """Delete lab account. This operation can take a while to complete. + # type: (...) -> LROPoller["_models.LabPlan"] + """Updates a Lab Plan resource. + + Operation to update a Lab Plan resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.LabPlanUpdate :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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] + :return: An instance of LROPoller that returns either LabPlan or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.labservices.models.LabPlan] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LabPlan"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, + lab_plan_name=lab_plan_name, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -447,16 +504,19 @@ def begin_delete( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LabPlan', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -468,44 +528,29 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - def update( + def _delete_initial( self, resource_group_name, # type: str - lab_account_name, # type: str - lab_account, # type: "_models.LabAccountFragment" + lab_plan_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.LabAccount" - """Modify properties of lab accounts. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_account: Represents a lab account. - :type lab_account: ~azure.mgmt.labservices.models.LabAccountFragment - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LabAccount, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.LabAccount - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LabAccount"] + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -515,65 +560,115 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(lab_account, 'LabAccountFragment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) - - deserialized = self._deserialize('LabAccount', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore - def create_lab( + def begin_delete( self, resource_group_name, # type: str - lab_account_name, # type: str - create_lab_properties, # type: "_models.CreateLabProperties" + lab_plan_name, # type: str **kwargs # type: Any ): - # type: (...) -> None - """Create a lab in a lab account. + # type: (...) -> LROPoller[None] + """Deletes a Lab Plan resource. + + Operation to delete a Lab Plan resource. Deleting a lab plan does not delete labs associated + with a lab plan, nor does it delete shared images added to a gallery via the lab plan + permission container. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param create_lab_properties: Properties for creating a managed lab and a default environment - setting. - :type create_lab_properties: ~azure.mgmt.labservices.models.CreateLabProperties + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + lab_plan_name=lab_plan_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}'} # type: ignore + + def _save_image_initial( + self, + resource_group_name, # type: str + lab_plan_name, # type: str + body, # type: "_models.SaveImageBody" + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_lab.metadata['url'] # type: ignore + url = self._save_image_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -587,76 +682,90 @@ def create_lab( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(create_lab_properties, 'CreateLabProperties') + body_content = self._serialize.body(body, 'SaveImageBody') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - create_lab.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/createLab'} # type: ignore + _save_image_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/saveImage'} # type: ignore - def get_regional_availability( + def begin_save_image( self, resource_group_name, # type: str - lab_account_name, # type: str + lab_plan_name, # type: str + body, # type: "_models.SaveImageBody" **kwargs # type: Any ): - # type: (...) -> "_models.GetRegionalAvailabilityResponse" - """Get regional availability information for each size category configured under a lab account. + # type: (...) -> LROPoller[None] + """Save an image from a lab VM to the attached shared image gallery. + + Saves an image from a lab VM to the attached shared image gallery. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str + :param lab_plan_name: The name of the lab plan that uniquely identifies it within containing + resource group. Used in resource URIs and in UI. + :type lab_plan_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.SaveImageBody :keyword callable cls: A custom type or function that will be passed the direct response - :return: GetRegionalAvailabilityResponse, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.GetRegionalAvailabilityResponse - :raises: ~azure.core.exceptions.HttpResponseError + :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: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GetRegionalAvailabilityResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - # Construct URL - url = self.get_regional_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._save_image_initial( + resource_group_name=resource_group_name, + lab_plan_name=lab_plan_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) - 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) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) - deserialized = self._deserialize('GetRegionalAvailabilityResponse', pipeline_response) + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - if cls: - return cls(pipeline_response, deserialized, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labPlanName': self._serialize.url("lab_plan_name", lab_plan_name, 'str', max_length=100, min_length=1), + } - return deserialized - get_regional_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/getRegionalAvailability'} # type: ignore + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_save_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/saveImage'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_labs_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_labs_operations.py index 9af18cad1287..0a2517ac4ae6 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_labs_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_labs_operations.py @@ -47,42 +47,29 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def list( + def list_by_subscription( self, - resource_group_name, # type: str - lab_account_name, # type: str - expand=None, # type: Optional[str] filter=None, # type: Optional[str] - top=None, # type: Optional[int] - orderby=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.ResponseWithContinuationLab"] - """List labs in a given lab account. + # type: (...) -> Iterable["_models.PagedLabs"] + """Get all labs for a subscription. + + Returns a list of all labs for a subscription. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param expand: Specify the $expand query. Example: 'properties($select=maxUsersInLab)'. - :type expand: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationLab or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationLab] + :return: An iterator like instance of either PagedLabs or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.PagedLabs] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationLab"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedLabs"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -92,23 +79,89 @@ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] # type: ignore + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PagedLabs', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PagedLabs"] + """Get all labs for a subscription and resource group. + + Returns a list of all labs in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedLabs or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.PagedLabs] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedLabs"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) @@ -119,7 +172,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationLab', pipeline_response) + deserialized = self._deserialize('PagedLabs', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,35 +185,33 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs'} # type: ignore + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs'} # type: ignore def get( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - expand=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "_models.Lab" - """Get lab. + """Get a lab resource. - :param resource_group_name: The name of the resource group. + Returns the properties of a lab resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param expand: Specify the $expand query. Example: 'properties($select=maxUsersInLab)'. - :type expand: str :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.labservices.models.Lab @@ -171,23 +222,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -200,7 +248,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Lab', pipeline_response) @@ -208,48 +257,31 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - def create_or_update( + def _create_or_update_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - lab, # type: "_models.Lab" + body, # type: "_models.Lab" **kwargs # type: Any ): # type: (...) -> "_models.Lab" - """Create or replace an existing Lab. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param lab: Represents a lab. - :type lab: ~azure.mgmt.labservices.models.Lab - :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.labservices.models.Lab - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -263,15 +295,16 @@ def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(lab, 'Lab') + body_content = self._serialize.body(body, 'Lab') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Lab', pipeline_response) @@ -279,35 +312,113 @@ def create_or_update( if response.status_code == 201: deserialized = self._deserialize('Lab', pipeline_response) + if response.status_code == 202: + deserialized = self._deserialize('Lab', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - def _delete_initial( + def begin_create_or_update( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str + body, # type: "_models.Lab" **kwargs # type: Any ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + # type: (...) -> LROPoller["_models.Lab"] + """Create or update a lab resource. + + Operation to create or update a lab resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.Lab + :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 Lab or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.labservices.models.Lab] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Lab', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + lab_name, # type: str + body, # type: "_models.LabUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.Lab" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -317,59 +428,74 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'LabUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Lab', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Lab', pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - def begin_delete( + def begin_update( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str + body, # type: "_models.LabUpdate" **kwargs # type: Any ): - # type: (...) -> LROPoller[None] - """Delete lab. This operation can take a while to complete. + # type: (...) -> LROPoller["_models.Lab"] + """Update a lab resource. + + Operation to update a lab resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.LabUpdate :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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] + :return: An instance of LROPoller that returns either Lab or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.labservices.models.Lab] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -378,17 +504,19 @@ def begin_delete( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Lab', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -400,48 +528,29 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - def update( + def _delete_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - lab, # type: "_models.LabFragment" **kwargs # type: Any ): - # type: (...) -> "_models.Lab" - """Modify properties of labs. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param lab: Represents a lab. - :type lab: ~azure.mgmt.labservices.models.LabFragment - :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.labservices.models.Lab - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Lab"] + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -451,68 +560,111 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(lab, 'LabFragment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) - - deserialized = self._deserialize('Lab', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore - def add_users( + def begin_delete( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - add_users_payload, # type: "_models.AddUsersPayload" **kwargs # type: Any ): - # type: (...) -> None - """Add users to a lab. + # type: (...) -> LROPoller[None] + """Deletes a lab resource. + + Operation to delete a lab resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param add_users_payload: Payload for Add Users operation on a Lab. - :type add_users_payload: ~azure.mgmt.labservices.models.AddUsersPayload :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 + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}'} # type: ignore + + def _publish_initial( + self, + resource_group_name, # type: str + lab_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.add_users.metadata['url'] # type: ignore + url = self._publish_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -522,61 +674,112 @@ def add_users( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(add_users_payload, 'AddUsersPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - add_users.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/addUsers'} # type: ignore + _publish_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/publish'} # type: ignore - def register( + def begin_publish( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str **kwargs # type: Any ): - # type: (...) -> None - """Register to managed lab. + # type: (...) -> LROPoller[None] + """Publish or re-publish a lab. - :param resource_group_name: The name of the resource group. + Publish or re-publish a lab. This will create or update all lab resources, such as virtual + machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_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 + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._publish_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_publish.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/publish'} # type: ignore + + def _sync_group_initial( + self, + resource_group_name, # type: str + lab_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.register.metadata['url'] # type: ignore + url = self._sync_group_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -592,11 +795,80 @@ def register( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - register.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/register'} # type: ignore + _sync_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/syncGroup'} # type: ignore + + def begin_sync_group( + self, + resource_group_name, # type: str + lab_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Manually sync the lab group. + + Action used to manually kick off an AAD group sync job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._sync_group_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/syncGroup'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_operation_results_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_operation_results_operations.py new file mode 100644 index 000000000000..98785b440876 --- /dev/null +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_operation_results_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationResultsOperations(object): + """OperationResultsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.labservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + operation_result_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.OperationResult"] + """Get an azure operation result. + + Returns an azure operation result. + + :param operation_result_id: The operation result ID / name. + :type operation_result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.OperationResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'operationResultId': self._serialize.url("operation_result_id", operation_result_id, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/operationResults/{operationResultId}'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_operations.py index 69a09d7395cc..5b3135fd47ae 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_operations.py @@ -9,6 +9,7 @@ import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -17,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,61 +45,68 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def get( + def list( self, - location_name, # type: str - operation_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.OperationResult" - """Get operation. + # type: (...) -> Iterable["_models.OperationListResult"] + """Get all operations. + + Returns a list of all operations. - :param location_name: The name of the location. - :type location_name: str - :param operation_name: The name of the operation. - :type operation_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationResult, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.OperationResult + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationName': self._serialize.url("operation_name", operation_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('OperationResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{locationName}/operations/{operationName}'} # type: ignore + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.LabServices/operations'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_provider_operations_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_provider_operations_operations.py deleted file mode 100644 index 85461507fa6b..000000000000 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_provider_operations_operations.py +++ /dev/null @@ -1,109 +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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ProviderOperationsOperations(object): - """ProviderOperationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.labservices.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProviderOperationResult"] - """Result of the request to list REST API operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProviderOperationResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.ProviderOperationResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderOperationResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ProviderOperationResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.LabServices/operations'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_schedules_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_schedules_operations.py new file mode 100644 index 000000000000..8171172d8f96 --- /dev/null +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_schedules_operations.py @@ -0,0 +1,478 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SchedulesOperations(object): + """SchedulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.labservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_lab( + self, + resource_group_name, # type: str + lab_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PagedSchedules"] + """Get all schedules for a lab. + + Returns a list of all schedules for a lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param filter: The filter to apply to the operation. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedSchedules or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.PagedSchedules] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedSchedules"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_lab.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PagedSchedules', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_lab.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules'} # type: ignore + + def get( + self, + resource_group_name, # type: str + lab_name, # type: str + schedule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Schedule" + """Get a lab Schedule. + + Returns the properties of a lab Schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param schedule_name: The name of the schedule that uniquely identifies it within containing + lab. Used in resource URIs. + :type schedule_name: str + :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.labservices.models.Schedule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Schedule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Schedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + lab_name, # type: str + schedule_name, # type: str + body, # type: "_models.Schedule" + **kwargs # type: Any + ): + # type: (...) -> "_models.Schedule" + """Create or update a lab schedule. + + Operation to create or update a lab schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param schedule_name: The name of the schedule that uniquely identifies it within containing + lab. Used in resource URIs. + :type schedule_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.Schedule + :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.labservices.models.Schedule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Schedule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'Schedule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Schedule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Schedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + lab_name, # type: str + schedule_name, # type: str + body, # type: "_models.ScheduleUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.Schedule" + """Update a lab schedule. + + Operation to update a lab schedule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param schedule_name: The name of the schedule that uniquely identifies it within containing + lab. Used in resource URIs. + :type schedule_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.ScheduleUpdate + :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.labservices.models.Schedule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Schedule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'ScheduleUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Schedule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + lab_name, # type: str + schedule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + lab_name, # type: str + schedule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a schedule resource. + + Operation to delete a schedule resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param schedule_name: The name of the schedule that uniquely identifies it within containing + lab. Used in resource URIs. + :type schedule_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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + schedule_name=schedule_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'scheduleName': self._serialize.url("schedule_name", schedule_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_users_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_users_operations.py index 3b8f583f8844..664e660dca15 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_users_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_users_operations.py @@ -47,45 +47,36 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def list( + def list_by_lab( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - expand=None, # type: Optional[str] filter=None, # type: Optional[str] - top=None, # type: Optional[int] - orderby=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.ResponseWithContinuationUser"] - """List users in a given lab. + # type: (...) -> Iterable["_models.PagedUsers"] + """Get all users for a lab. - :param resource_group_name: The name of the resource group. + Returns a list of all users for a lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param expand: Specify the $expand query. Example: 'properties($select=email)'. - :type expand: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationUser or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationUser] + :return: An iterator like instance of either PagedUsers or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.PagedUsers] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationUser"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedUsers"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -95,25 +86,18 @@ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] # type: ignore + url = self.list_by_lab.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -123,7 +107,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationUser', pipeline_response) + deserialized = self._deserialize('PagedUsers', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -136,38 +120,37 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users'} # type: ignore + list_by_lab.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users'} # type: ignore def get( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str user_name, # type: str - expand=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "_models.User" - """Get user. + """Get a lab user. + + Returns the properties of a lab user. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param user_name: The name of the user. + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. :type user_name: str - :param expand: Specify the $expand query. Example: 'properties($select=email)'. - :type expand: str :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.labservices.models.User @@ -178,24 +161,21 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -208,7 +188,8 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('User', pipeline_response) @@ -216,52 +197,178 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore - def create_or_update( + def _create_or_update_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str user_name, # type: str - user, # type: "_models.User" + body, # type: "_models.User" **kwargs # type: Any ): # type: (...) -> "_models.User" - """Create or replace an existing User. + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'User') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - :param resource_group_name: The name of the resource group. + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('User', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('User', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + lab_name, # type: str + user_name, # type: str + body, # type: "_models.User" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.User"] + """Create or update a lab user. + + Operation to create or update a lab user. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param user_name: The name of the user. + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. :type user_name: str - :param user: The User registered to a lab. - :type user: ~azure.mgmt.labservices.models.User + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.User :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.labservices.models.User - :raises: ~azure.core.exceptions.HttpResponseError + :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 User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.labservices.models.User] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + user_name=user_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + lab_name, # type: str + user_name, # type: str + body, # type: "_models.UserUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.User" cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -275,32 +382,113 @@ def create_or_update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'User') + body_content = self._serialize.body(body, 'UserUpdate') body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('User', pipeline_response) - if response.status_code == 201: + if response.status_code == 202: deserialized = self._deserialize('User', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + lab_name, # type: str + user_name, # type: str + body, # type: "_models.UserUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.User"] + """Update a lab user. + + Operation to update a lab user. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. + :type user_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.UserUpdate + :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 User or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.labservices.models.User] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + user_name=user_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('User', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore def _delete_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str user_name, # type: str **kwargs # type: Any @@ -311,17 +499,16 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -337,38 +524,40 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore def begin_delete( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str user_name, # type: str **kwargs # type: Any ): # type: (...) -> LROPoller[None] - """Delete user. This operation can take a while to complete. + """Deletes a user resource. - :param resource_group_name: The name of the resource group. + Operation to delete a user resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param user_name: The name of the user. + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. :type user_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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) @@ -385,7 +574,6 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, user_name=user_name, cls=lambda x,y,z: x, @@ -400,14 +588,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -419,52 +606,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}'} # type: ignore - def update( + def _invite_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str user_name, # type: str - user, # type: "_models.UserFragment" + body, # type: "_models.InviteBody" **kwargs # type: Any ): - # type: (...) -> "_models.User" - """Modify properties of users. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param user_name: The name of the user. - :type user_name: str - :param user: The User registered to a lab. - :type user: ~azure.mgmt.labservices.models.UserFragment - :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.labservices.models.User - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.User"] + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._invite_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'userName': self._serialize.url("user_name", user_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -478,20 +646,96 @@ def update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(user, 'UserFragment') + body_content = self._serialize.body(body, 'InviteBody') body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) - - deserialized = self._deserialize('User', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'} # type: ignore + _invite_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}/invite'} # type: ignore + + def begin_invite( + self, + resource_group_name, # type: str + lab_name, # type: str + user_name, # type: str + body, # type: "_models.InviteBody" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Invite a user to a lab. + + Operation to invite a user to a lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. + :type lab_name: str + :param user_name: The name of the user that uniquely identifies it within containing lab. Used + in resource URIs. + :type user_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.InviteBody + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._invite_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + user_name=user_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'userName': self._serialize.url("user_name", user_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_invite.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}/invite'} # type: ignore diff --git a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_environment_settings_operations.py b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_virtual_machines_operations.py similarity index 53% rename from sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_environment_settings_operations.py rename to sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_virtual_machines_operations.py index 75e891961d89..5839085eb97d 100644 --- a/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_environment_settings_operations.py +++ b/sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_virtual_machines_operations.py @@ -25,8 +25,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class EnvironmentSettingsOperations(object): - """EnvironmentSettingsOperations operations. +class VirtualMachinesOperations(object): + """VirtualMachinesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -47,45 +47,36 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def list( + def list_by_lab( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - expand=None, # type: Optional[str] filter=None, # type: Optional[str] - top=None, # type: Optional[int] - orderby=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.ResponseWithContinuationEnvironmentSetting"] - """List environment setting in a given lab. + # type: (...) -> Iterable["_models.PagedVirtualMachines"] + """Get all virtual machines for a lab. - :param resource_group_name: The name of the resource group. + Returns a list of all virtual machines for a lab. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param expand: Specify the $expand query. Example: 'properties($select=publishingState)'. - :type expand: str :param filter: The filter to apply to the operation. :type filter: str - :param top: The maximum number of resources to return from the operation. - :type top: int - :param orderby: The ordering expression for the results, using OData notation. - :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 ResponseWithContinuationEnvironmentSetting or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.ResponseWithContinuationEnvironmentSetting] + :return: An iterator like instance of either PagedVirtualMachines or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.labservices.models.PagedVirtualMachines] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResponseWithContinuationEnvironmentSetting"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedVirtualMachines"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -95,25 +86,18 @@ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] # type: ignore + url = self.list_by_lab.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: @@ -123,7 +107,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResponseWithContinuationEnvironmentSetting', pipeline_response) + deserialized = self._deserialize('PagedVirtualMachines', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -136,66 +120,62 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings'} # type: ignore + list_by_lab.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines'} # type: ignore def get( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str - expand=None, # type: Optional[str] + virtual_machine_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.EnvironmentSetting" - """Get environment setting. + # type: (...) -> "_models.VirtualMachine" + """Get a lab virtual machine. - :param resource_group_name: The name of the resource group. + Returns the properties for a lab virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param expand: Specify the $expand query. Example: 'properties($select=publishingState)'. - :type expand: str + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: EnvironmentSetting, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.EnvironmentSetting + :return: VirtualMachine, or the result of cls(response) + :rtype: ~azure.mgmt.labservices.models.VirtualMachine :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnvironmentSetting"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -208,43 +188,40 @@ def get( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) + deserialized = self._deserialize('VirtualMachine', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}'} # type: ignore - def _create_or_update_initial( + def _start_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str - environment_setting, # type: "_models.EnvironmentSetting" + virtual_machine_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.EnvironmentSetting" - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnvironmentSetting"] + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore + url = self._start_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -254,79 +231,64 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_setting, 'EnvironmentSetting') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) - - if response.status_code == 200: - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/start'} # type: ignore - def begin_create_or_update( + def begin_start( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str - environment_setting, # type: "_models.EnvironmentSetting" + virtual_machine_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.EnvironmentSetting"] - """Create or replace an existing Environment Setting. This operation can take a while to complete. + # type: (...) -> LROPoller[None] + """Start a lab virtual machine. + + Action to start a lab virtual machine. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_setting: Represents settings of an environment, from which environment - instances would be created. - :type environment_setting: ~azure.mgmt.labservices.models.EnvironmentSetting + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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 EnvironmentSetting or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.labservices.models.EnvironmentSetting] + :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: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnvironmentSetting"] + cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._start_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, - environment_setting_name=environment_setting_name, - environment_setting=environment_setting, + virtual_machine_name=virtual_machine_name, cls=lambda x,y,z: x, **kwargs ) @@ -335,21 +297,17 @@ def begin_create_or_update( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -361,14 +319,13 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/start'} # type: ignore - def _delete_initial( + def _stop_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str + virtual_machine_name, # type: str **kwargs # type: Any ): # type: (...) -> None @@ -377,17 +334,16 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore + url = self._stop_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -399,42 +355,44 @@ def _delete_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/stop'} # type: ignore - def begin_delete( + def begin_stop( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str + virtual_machine_name, # type: str **kwargs # type: Any ): # type: (...) -> LROPoller[None] - """Delete environment setting. This operation can take a while to complete. + """Stop a lab virtual machine. - :param resource_group_name: The name of the resource group. + Action to stop a lab virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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) @@ -449,11 +407,10 @@ def begin_delete( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._stop_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, - environment_setting_name=environment_setting_name, + virtual_machine_name=virtual_machine_name, cls=lambda x,y,z: x, **kwargs ) @@ -466,14 +423,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -485,124 +441,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/stop'} # type: ignore - def update( + def _reimage_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str - environment_setting, # type: "_models.EnvironmentSettingFragment" - **kwargs # type: Any - ): - # type: (...) -> "_models.EnvironmentSetting" - """Modify properties of environment setting. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param environment_setting: Represents settings of an environment, from which environment - instances would be created. - :type environment_setting: ~azure.mgmt.labservices.models.EnvironmentSettingFragment - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EnvironmentSetting, or the result of cls(response) - :rtype: ~azure.mgmt.labservices.models.EnvironmentSetting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnvironmentSetting"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(environment_setting, 'EnvironmentSettingFragment') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('EnvironmentSetting', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'} # type: ignore - - def claim_any( - self, - resource_group_name, # type: str - lab_account_name, # type: str - lab_name, # type: str - environment_setting_name, # type: str + virtual_machine_name, # type: str **kwargs # type: Any ): # type: (...) -> None - """Claims a random environment for a user in an environment settings. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. - :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self.claim_any.metadata['url'] # type: ignore + url = self._reimage_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -618,94 +481,96 @@ def claim_any( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - claim_any.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/claimAny'} # type: ignore + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/reimage'} # type: ignore - def publish( + def begin_reimage( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str - publish_payload, # type: "_models.PublishPayload" + virtual_machine_name, # type: str **kwargs # type: Any ): - # type: (...) -> None - """Provisions/deprovisions required resources for an environment setting based on current state of - the lab/environment setting. + # type: (...) -> LROPoller[None] + """Re-image a lab virtual machine. + + Re-image a lab virtual machine. The virtual machine will be deleted and recreated using the + latest published snapshot of the reference environment of the lab. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str - :param publish_payload: Payload for Publish operation on EnvironmentSetting. - :type publish_payload: ~azure.mgmt.labservices.models.PublishPayload + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_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 + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.publish.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + lab_name=lab_name, + virtual_machine_name=virtual_machine_name, + cls=lambda x,y,z: x, + **kwargs + ) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(publish_payload, 'PublishPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) - 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) + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - if cls: - return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), + } - publish.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/publish'} # type: ignore + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/reimage'} # type: ignore - def _start_initial( + def _redeploy_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str + virtual_machine_name, # type: str **kwargs # type: Any ): # type: (...) -> None @@ -714,17 +579,16 @@ def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" accept = "application/json" # Construct URL - url = self._start_initial.metadata['url'] # type: ignore + url = self._redeploy_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -742,37 +606,39 @@ def _start_initial( 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/start'} # type: ignore + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/redeploy'} # type: ignore - def begin_start( + def begin_redeploy( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str + virtual_machine_name, # type: str **kwargs # type: Any ): # type: (...) -> LROPoller[None] - """Starts a template by starting all resources inside the template. This operation can take a - while to complete. + """Redeploy a lab virtual machine to a different compute node. For troubleshooting connectivity. + + Action to redeploy a lab virtual machine to a different compute node. For troubleshooting + connectivity. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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) @@ -787,11 +653,10 @@ def begin_start( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._redeploy_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, - environment_setting_name=environment_setting_name, + virtual_machine_name=virtual_machine_name, cls=lambda x,y,z: x, **kwargs ) @@ -804,14 +669,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -823,14 +687,14 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/start'} # type: ignore + begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/redeploy'} # type: ignore - def _stop_initial( + def _reset_password_initial( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str + virtual_machine_name, # type: str + body, # type: "_models.ResetPasswordBody" **kwargs # type: Any ): # type: (...) -> None @@ -839,17 +703,17 @@ def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-10-15" + api_version = "2021-10-01-preview" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore + url = self._reset_password_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -859,45 +723,53 @@ def _stop_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.post(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(body, 'ResetPasswordBody') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/stop'} # type: ignore + _reset_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/resetPassword'} # type: ignore - def begin_stop( + def begin_reset_password( self, resource_group_name, # type: str - lab_account_name, # type: str lab_name, # type: str - environment_setting_name, # type: str + virtual_machine_name, # type: str + body, # type: "_models.ResetPasswordBody" **kwargs # type: Any ): # type: (...) -> LROPoller[None] - """Starts a template by starting all resources inside the template. This operation can take a - while to complete. + """Reset a lab virtual machine password. - :param resource_group_name: The name of the resource group. + Resets a lab virtual machine password. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param lab_account_name: The name of the lab Account. - :type lab_account_name: str - :param lab_name: The name of the lab. + :param lab_name: The name of the lab that uniquely identifies it within containing lab account. + Used in resource URIs. :type lab_name: str - :param environment_setting_name: The name of the environment Setting. - :type environment_setting_name: str + :param virtual_machine_name: The ID of the virtual machine that uniquely identifies it within + the containing lab. Used in resource URIs. + :type virtual_machine_name: str + :param body: The request body. + :type body: ~azure.mgmt.labservices.models.ResetPasswordBody :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :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) @@ -912,11 +784,11 @@ def begin_stop( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._reset_password_initial( resource_group_name=resource_group_name, - lab_account_name=lab_account_name, lab_name=lab_name, - environment_setting_name=environment_setting_name, + virtual_machine_name=virtual_machine_name, + body=body, cls=lambda x,y,z: x, **kwargs ) @@ -929,14 +801,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'labAccountName': self._serialize.url("lab_account_name", lab_account_name, 'str'), - 'labName': self._serialize.url("lab_name", lab_name, 'str'), - 'environmentSettingName': self._serialize.url("environment_setting_name", environment_setting_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'labName': self._serialize.url("lab_name", lab_name, 'str', max_length=100, min_length=1), + 'virtualMachineName': self._serialize.url("virtual_machine_name", virtual_machine_name, 'str', max_length=100, min_length=1, pattern=r'^[-\w\\._\\(\\)]+$'), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -948,4 +819,4 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/stop'} # type: ignore + begin_reset_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}/resetPassword'} # type: ignore