diff --git a/sdk/testbase/azure-mgmt-testbase/CHANGELOG.md b/sdk/testbase/azure-mgmt-testbase/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/testbase/azure-mgmt-testbase/MANIFEST.in b/sdk/testbase/azure-mgmt-testbase/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/testbase/azure-mgmt-testbase/README.md b/sdk/testbase/azure-mgmt-testbase/README.md new file mode 100644 index 000000000000..4c2292957a39 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-testbase%2FREADME.png) diff --git a/sdk/testbase/azure-mgmt-testbase/_meta.json b/sdk/testbase/azure-mgmt-testbase/_meta.json new file mode 100644 index 000000000000..f47cae2a7e1d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.4.2", + "use": "@autorest/python@5.6.6", + "commit": "766f184d79ce05c82c4743224ea3f33b4cb088b2", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/testbase/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.6 --version=3.4.2", + "readme": "specification/testbase/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/testbase/azure-mgmt-testbase/azure/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/__init__.py new file mode 100644 index 000000000000..18925eae50bb --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._restap_ifor_test_base import RESTAPIForTestBase +from ._version import VERSION + +__version__ = VERSION +__all__ = ['RESTAPIForTestBase'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_configuration.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_configuration.py new file mode 100644 index 000000000000..4d6bf053d91c --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class RESTAPIForTestBaseConfiguration(Configuration): + """Configuration for RESTAPIForTestBase. + + 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 Azure subscription ID. This is a GUID-formatted string. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(RESTAPIForTestBaseConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-05-10-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-testbase/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_metadata.json b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_metadata.json new file mode 100644 index 000000000000..c2ed49a0b1b9 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_metadata.json @@ -0,0 +1,191 @@ +{ + "chosen_version": "2021-05-10-preview", + "total_api_version_list": ["2021-05-10-preview"], + "client": { + "name": "RESTAPIForTestBase", + "filename": "_restap_ifor_test_base", + "description": "REST API for Test Base.", + "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\": [\"RESTAPIForTestBaseConfiguration\"], \"._operations_mixin\": [\"RESTAPIForTestBaseOperationsMixin\"]}}, \"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\": [\"RESTAPIForTestBaseConfiguration\"], \"._operations_mixin\": [\"RESTAPIForTestBaseOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The Azure subscription ID. This is a GUID-formatted string.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Azure subscription ID. This is a GUID-formatted string.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "skus": "SKUsOperations", + "test_base_accounts": "TestBaseAccountsOperations", + "test_base_account": "TestBaseAccountOperations", + "test_base_account_usage": "TestBaseAccountUsageOperations", + "test_base_account_available_oss": "TestBaseAccountAvailableOSsOperations", + "test_base_account_available_os": "TestBaseAccountAvailableOSOperations", + "test_base_account_flighting_rings": "TestBaseAccountFlightingRingsOperations", + "test_base_account_flighting_ring": "TestBaseAccountFlightingRingOperations", + "test_base_account_test_types": "TestBaseAccountTestTypesOperations", + "test_base_account_test_type": "TestBaseAccountTestTypeOperations", + "packages": "PackagesOperations", + "package": "PackageOperations", + "test_summaries": "TestSummariesOperations", + "test_summary": "TestSummaryOperations", + "test_results": "TestResultsOperations", + "test_result": "TestResultOperations", + "os_updates": "OSUpdatesOperations", + "os_update": "OSUpdateOperations", + "favorite_processes": "FavoriteProcessesOperations", + "favorite_process": "FavoriteProcessOperations", + "analysis_results": "AnalysisResultsOperations", + "analysis_result": "AnalysisResultOperations", + "operations": "Operations" + }, + "operation_mixins": { + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "operations": { + "test_base_account_get_file_upload_url" : { + "sync": { + "signature": "def test_base_account_get_file_upload_url(\n self,\n resource_group_name, # type: str\n test_base_account_name, # type: str\n parameters=None, # type: Optional[\"_models.GetFileUploadURLParameters\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the file upload URL of a Test Base Account.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param parameters: Parameters supplied to the Test Base Account GetFileUploadURL operation.\n:type parameters: ~restap_ifor_test_base.models.GetFileUploadURLParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FileUploadURLResponse, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.FileUploadURLResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_base_account_get_file_upload_url(\n self,\n resource_group_name: str,\n test_base_account_name: str,\n parameters: Optional[\"_models.GetFileUploadURLParameters\"] = None,\n **kwargs\n) -\u003e \"_models.FileUploadURLResponse\":\n", + "doc": "\"\"\"Gets the file upload URL of a Test Base Account.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param parameters: Parameters supplied to the Test Base Account GetFileUploadURL operation.\n:type parameters: ~restap_ifor_test_base.models.GetFileUploadURLParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: FileUploadURLResponse, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.FileUploadURLResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, test_base_account_name, parameters" + }, + "check_package_name_availability" : { + "sync": { + "signature": "def check_package_name_availability(\n self,\n resource_group_name, # type: str\n test_base_account_name, # type: str\n parameters, # type: \"_models.PackageCheckNameAvailabilityParameters\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Checks that the Test Base Package name and version is valid and is not already in use.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param parameters: Parameters supplied to the Test Base Package CheckNameAvailability\n operation.\n:type parameters: ~restap_ifor_test_base.models.PackageCheckNameAvailabilityParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityResult, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.CheckNameAvailabilityResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_package_name_availability(\n self,\n resource_group_name: str,\n test_base_account_name: str,\n parameters: \"_models.PackageCheckNameAvailabilityParameters\",\n **kwargs\n) -\u003e \"_models.CheckNameAvailabilityResult\":\n", + "doc": "\"\"\"Checks that the Test Base Package name and version is valid and is not already in use.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param parameters: Parameters supplied to the Test Base Package CheckNameAvailability\n operation.\n:type parameters: ~restap_ifor_test_base.models.PackageCheckNameAvailabilityParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityResult, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.CheckNameAvailabilityResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, test_base_account_name, parameters" + }, + "package_get_download_url" : { + "sync": { + "signature": "def package_get_download_url(\n self,\n resource_group_name, # type: str\n test_base_account_name, # type: str\n package_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the download URL of a package.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param package_name: The resource name of the Test Base Package.\n:type package_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DownloadURLResponse, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.DownloadURLResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def package_get_download_url(\n self,\n resource_group_name: str,\n test_base_account_name: str,\n package_name: str,\n **kwargs\n) -\u003e \"_models.DownloadURLResponse\":\n", + "doc": "\"\"\"Gets the download URL of a package.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param package_name: The resource name of the Test Base Package.\n:type package_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DownloadURLResponse, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.DownloadURLResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, test_base_account_name, package_name" + }, + "test_result_get_download_url" : { + "sync": { + "signature": "def test_result_get_download_url(\n self,\n resource_group_name, # type: str\n test_base_account_name, # type: str\n package_name, # type: str\n test_result_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the download URL or the test result.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param package_name: The resource name of the Test Base Package.\n:type package_name: str\n:param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string.\n:type test_result_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DownloadURLResponse, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.DownloadURLResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_result_get_download_url(\n self,\n resource_group_name: str,\n test_base_account_name: str,\n package_name: str,\n test_result_name: str,\n **kwargs\n) -\u003e \"_models.DownloadURLResponse\":\n", + "doc": "\"\"\"Gets the download URL or the test result.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param package_name: The resource name of the Test Base Package.\n:type package_name: str\n:param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string.\n:type test_result_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DownloadURLResponse, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.DownloadURLResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, test_base_account_name, package_name, test_result_name" + }, + "test_result_get_video_download_url" : { + "sync": { + "signature": "def test_result_get_video_download_url(\n self,\n resource_group_name, # type: str\n test_base_account_name, # type: str\n package_name, # type: str\n test_result_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the download URL of the test execution screen recording.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param package_name: The resource name of the Test Base Package.\n:type package_name: str\n:param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string.\n:type test_result_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DownloadURLResponse, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.DownloadURLResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_result_get_video_download_url(\n self,\n resource_group_name: str,\n test_base_account_name: str,\n package_name: str,\n test_result_name: str,\n **kwargs\n) -\u003e \"_models.DownloadURLResponse\":\n", + "doc": "\"\"\"Gets the download URL of the test execution screen recording.\n\n:param resource_group_name: The name of the resource group that contains the resource.\n:type resource_group_name: str\n:param test_base_account_name: The resource name of the Test Base Account.\n:type test_base_account_name: str\n:param package_name: The resource name of the Test Base Package.\n:type package_name: str\n:param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string.\n:type test_result_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DownloadURLResponse, or the result of cls(response)\n:rtype: ~restap_ifor_test_base.models.DownloadURLResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, test_base_account_name, package_name, test_result_name" + } + } + } +} \ No newline at end of file diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_restap_ifor_test_base.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_restap_ifor_test_base.py new file mode 100644 index 000000000000..3f7e3feeb139 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_restap_ifor_test_base.py @@ -0,0 +1,200 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import RESTAPIForTestBaseConfiguration +from .operations import SKUsOperations +from .operations import TestBaseAccountsOperations +from .operations import TestBaseAccountOperations +from .operations import TestBaseAccountUsageOperations +from .operations import RESTAPIForTestBaseOperationsMixin +from .operations import TestBaseAccountAvailableOSsOperations +from .operations import TestBaseAccountAvailableOSOperations +from .operations import TestBaseAccountFlightingRingsOperations +from .operations import TestBaseAccountFlightingRingOperations +from .operations import TestBaseAccountTestTypesOperations +from .operations import TestBaseAccountTestTypeOperations +from .operations import PackagesOperations +from .operations import PackageOperations +from .operations import TestSummariesOperations +from .operations import TestSummaryOperations +from .operations import TestResultsOperations +from .operations import TestResultOperations +from .operations import OSUpdatesOperations +from .operations import OSUpdateOperations +from .operations import FavoriteProcessesOperations +from .operations import FavoriteProcessOperations +from .operations import AnalysisResultsOperations +from .operations import AnalysisResultOperations +from .operations import Operations +from . import models + + +class RESTAPIForTestBase(RESTAPIForTestBaseOperationsMixin): + """REST API for Test Base. + + :ivar skus: SKUsOperations operations + :vartype skus: restap_ifor_test_base.operations.SKUsOperations + :ivar test_base_accounts: TestBaseAccountsOperations operations + :vartype test_base_accounts: restap_ifor_test_base.operations.TestBaseAccountsOperations + :ivar test_base_account: TestBaseAccountOperations operations + :vartype test_base_account: restap_ifor_test_base.operations.TestBaseAccountOperations + :ivar test_base_account_usage: TestBaseAccountUsageOperations operations + :vartype test_base_account_usage: restap_ifor_test_base.operations.TestBaseAccountUsageOperations + :ivar test_base_account_available_oss: TestBaseAccountAvailableOSsOperations operations + :vartype test_base_account_available_oss: restap_ifor_test_base.operations.TestBaseAccountAvailableOSsOperations + :ivar test_base_account_available_os: TestBaseAccountAvailableOSOperations operations + :vartype test_base_account_available_os: restap_ifor_test_base.operations.TestBaseAccountAvailableOSOperations + :ivar test_base_account_flighting_rings: TestBaseAccountFlightingRingsOperations operations + :vartype test_base_account_flighting_rings: restap_ifor_test_base.operations.TestBaseAccountFlightingRingsOperations + :ivar test_base_account_flighting_ring: TestBaseAccountFlightingRingOperations operations + :vartype test_base_account_flighting_ring: restap_ifor_test_base.operations.TestBaseAccountFlightingRingOperations + :ivar test_base_account_test_types: TestBaseAccountTestTypesOperations operations + :vartype test_base_account_test_types: restap_ifor_test_base.operations.TestBaseAccountTestTypesOperations + :ivar test_base_account_test_type: TestBaseAccountTestTypeOperations operations + :vartype test_base_account_test_type: restap_ifor_test_base.operations.TestBaseAccountTestTypeOperations + :ivar packages: PackagesOperations operations + :vartype packages: restap_ifor_test_base.operations.PackagesOperations + :ivar package: PackageOperations operations + :vartype package: restap_ifor_test_base.operations.PackageOperations + :ivar test_summaries: TestSummariesOperations operations + :vartype test_summaries: restap_ifor_test_base.operations.TestSummariesOperations + :ivar test_summary: TestSummaryOperations operations + :vartype test_summary: restap_ifor_test_base.operations.TestSummaryOperations + :ivar test_results: TestResultsOperations operations + :vartype test_results: restap_ifor_test_base.operations.TestResultsOperations + :ivar test_result: TestResultOperations operations + :vartype test_result: restap_ifor_test_base.operations.TestResultOperations + :ivar os_updates: OSUpdatesOperations operations + :vartype os_updates: restap_ifor_test_base.operations.OSUpdatesOperations + :ivar os_update: OSUpdateOperations operations + :vartype os_update: restap_ifor_test_base.operations.OSUpdateOperations + :ivar favorite_processes: FavoriteProcessesOperations operations + :vartype favorite_processes: restap_ifor_test_base.operations.FavoriteProcessesOperations + :ivar favorite_process: FavoriteProcessOperations operations + :vartype favorite_process: restap_ifor_test_base.operations.FavoriteProcessOperations + :ivar analysis_results: AnalysisResultsOperations operations + :vartype analysis_results: restap_ifor_test_base.operations.AnalysisResultsOperations + :ivar analysis_result: AnalysisResultOperations operations + :vartype analysis_result: restap_ifor_test_base.operations.AnalysisResultOperations + :ivar operations: Operations operations + :vartype operations: restap_ifor_test_base.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string. + :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. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = RESTAPIForTestBaseConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.skus = SKUsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_accounts = TestBaseAccountsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account = TestBaseAccountOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_usage = TestBaseAccountUsageOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_available_oss = TestBaseAccountAvailableOSsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_available_os = TestBaseAccountAvailableOSOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_flighting_rings = TestBaseAccountFlightingRingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_flighting_ring = TestBaseAccountFlightingRingOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_test_types = TestBaseAccountTestTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_test_type = TestBaseAccountTestTypeOperations( + self._client, self._config, self._serialize, self._deserialize) + self.packages = PackagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.package = PackageOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_summaries = TestSummariesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_summary = TestSummaryOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_results = TestResultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_result = TestResultOperations( + self._client, self._config, self._serialize, self._deserialize) + self.os_updates = OSUpdatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.os_update = OSUpdateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.favorite_processes = FavoriteProcessesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.favorite_process = FavoriteProcessOperations( + self._client, self._config, self._serialize, self._deserialize) + self.analysis_results = AnalysisResultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.analysis_result = AnalysisResultOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + 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'), + } + 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: () -> RESTAPIForTestBase + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_version.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py new file mode 100644 index 000000000000..f665c642a0cb --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._restap_ifor_test_base import RESTAPIForTestBase +__all__ = ['RESTAPIForTestBase'] diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_configuration.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_configuration.py new file mode 100644 index 000000000000..8fc6c33cef4d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class RESTAPIForTestBaseConfiguration(Configuration): + """Configuration for RESTAPIForTestBase. + + 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 Azure subscription ID. This is a GUID-formatted string. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(RESTAPIForTestBaseConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-05-10-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-testbase/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_restap_ifor_test_base.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_restap_ifor_test_base.py new file mode 100644 index 000000000000..a874301daf16 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_restap_ifor_test_base.py @@ -0,0 +1,193 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import RESTAPIForTestBaseConfiguration +from .operations import SKUsOperations +from .operations import TestBaseAccountsOperations +from .operations import TestBaseAccountOperations +from .operations import TestBaseAccountUsageOperations +from .operations import RESTAPIForTestBaseOperationsMixin +from .operations import TestBaseAccountAvailableOSsOperations +from .operations import TestBaseAccountAvailableOSOperations +from .operations import TestBaseAccountFlightingRingsOperations +from .operations import TestBaseAccountFlightingRingOperations +from .operations import TestBaseAccountTestTypesOperations +from .operations import TestBaseAccountTestTypeOperations +from .operations import PackagesOperations +from .operations import PackageOperations +from .operations import TestSummariesOperations +from .operations import TestSummaryOperations +from .operations import TestResultsOperations +from .operations import TestResultOperations +from .operations import OSUpdatesOperations +from .operations import OSUpdateOperations +from .operations import FavoriteProcessesOperations +from .operations import FavoriteProcessOperations +from .operations import AnalysisResultsOperations +from .operations import AnalysisResultOperations +from .operations import Operations +from .. import models + + +class RESTAPIForTestBase(RESTAPIForTestBaseOperationsMixin): + """REST API for Test Base. + + :ivar skus: SKUsOperations operations + :vartype skus: restap_ifor_test_base.aio.operations.SKUsOperations + :ivar test_base_accounts: TestBaseAccountsOperations operations + :vartype test_base_accounts: restap_ifor_test_base.aio.operations.TestBaseAccountsOperations + :ivar test_base_account: TestBaseAccountOperations operations + :vartype test_base_account: restap_ifor_test_base.aio.operations.TestBaseAccountOperations + :ivar test_base_account_usage: TestBaseAccountUsageOperations operations + :vartype test_base_account_usage: restap_ifor_test_base.aio.operations.TestBaseAccountUsageOperations + :ivar test_base_account_available_oss: TestBaseAccountAvailableOSsOperations operations + :vartype test_base_account_available_oss: restap_ifor_test_base.aio.operations.TestBaseAccountAvailableOSsOperations + :ivar test_base_account_available_os: TestBaseAccountAvailableOSOperations operations + :vartype test_base_account_available_os: restap_ifor_test_base.aio.operations.TestBaseAccountAvailableOSOperations + :ivar test_base_account_flighting_rings: TestBaseAccountFlightingRingsOperations operations + :vartype test_base_account_flighting_rings: restap_ifor_test_base.aio.operations.TestBaseAccountFlightingRingsOperations + :ivar test_base_account_flighting_ring: TestBaseAccountFlightingRingOperations operations + :vartype test_base_account_flighting_ring: restap_ifor_test_base.aio.operations.TestBaseAccountFlightingRingOperations + :ivar test_base_account_test_types: TestBaseAccountTestTypesOperations operations + :vartype test_base_account_test_types: restap_ifor_test_base.aio.operations.TestBaseAccountTestTypesOperations + :ivar test_base_account_test_type: TestBaseAccountTestTypeOperations operations + :vartype test_base_account_test_type: restap_ifor_test_base.aio.operations.TestBaseAccountTestTypeOperations + :ivar packages: PackagesOperations operations + :vartype packages: restap_ifor_test_base.aio.operations.PackagesOperations + :ivar package: PackageOperations operations + :vartype package: restap_ifor_test_base.aio.operations.PackageOperations + :ivar test_summaries: TestSummariesOperations operations + :vartype test_summaries: restap_ifor_test_base.aio.operations.TestSummariesOperations + :ivar test_summary: TestSummaryOperations operations + :vartype test_summary: restap_ifor_test_base.aio.operations.TestSummaryOperations + :ivar test_results: TestResultsOperations operations + :vartype test_results: restap_ifor_test_base.aio.operations.TestResultsOperations + :ivar test_result: TestResultOperations operations + :vartype test_result: restap_ifor_test_base.aio.operations.TestResultOperations + :ivar os_updates: OSUpdatesOperations operations + :vartype os_updates: restap_ifor_test_base.aio.operations.OSUpdatesOperations + :ivar os_update: OSUpdateOperations operations + :vartype os_update: restap_ifor_test_base.aio.operations.OSUpdateOperations + :ivar favorite_processes: FavoriteProcessesOperations operations + :vartype favorite_processes: restap_ifor_test_base.aio.operations.FavoriteProcessesOperations + :ivar favorite_process: FavoriteProcessOperations operations + :vartype favorite_process: restap_ifor_test_base.aio.operations.FavoriteProcessOperations + :ivar analysis_results: AnalysisResultsOperations operations + :vartype analysis_results: restap_ifor_test_base.aio.operations.AnalysisResultsOperations + :ivar analysis_result: AnalysisResultOperations operations + :vartype analysis_result: restap_ifor_test_base.aio.operations.AnalysisResultOperations + :ivar operations: Operations operations + :vartype operations: restap_ifor_test_base.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string. + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = RESTAPIForTestBaseConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.skus = SKUsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_accounts = TestBaseAccountsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account = TestBaseAccountOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_usage = TestBaseAccountUsageOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_available_oss = TestBaseAccountAvailableOSsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_available_os = TestBaseAccountAvailableOSOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_flighting_rings = TestBaseAccountFlightingRingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_flighting_ring = TestBaseAccountFlightingRingOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_test_types = TestBaseAccountTestTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_base_account_test_type = TestBaseAccountTestTypeOperations( + self._client, self._config, self._serialize, self._deserialize) + self.packages = PackagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.package = PackageOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_summaries = TestSummariesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_summary = TestSummaryOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_results = TestResultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.test_result = TestResultOperations( + self._client, self._config, self._serialize, self._deserialize) + self.os_updates = OSUpdatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.os_update = OSUpdateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.favorite_processes = FavoriteProcessesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.favorite_process = FavoriteProcessOperations( + self._client, self._config, self._serialize, self._deserialize) + self.analysis_results = AnalysisResultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.analysis_result = AnalysisResultOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + 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'), + } + 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) -> "RESTAPIForTestBase": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/__init__.py new file mode 100644 index 000000000000..e051cdc25c0b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/__init__.py @@ -0,0 +1,59 @@ +# 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 ._skus_operations import SKUsOperations +from ._test_base_accounts_operations import TestBaseAccountsOperations +from ._test_base_account_operations import TestBaseAccountOperations +from ._test_base_account_usage_operations import TestBaseAccountUsageOperations +from ._restap_ifor_test_base_operations import RESTAPIForTestBaseOperationsMixin +from ._test_base_account_available_oss_operations import TestBaseAccountAvailableOSsOperations +from ._test_base_account_available_os_operations import TestBaseAccountAvailableOSOperations +from ._test_base_account_flighting_rings_operations import TestBaseAccountFlightingRingsOperations +from ._test_base_account_flighting_ring_operations import TestBaseAccountFlightingRingOperations +from ._test_base_account_test_types_operations import TestBaseAccountTestTypesOperations +from ._test_base_account_test_type_operations import TestBaseAccountTestTypeOperations +from ._packages_operations import PackagesOperations +from ._package_operations import PackageOperations +from ._test_summaries_operations import TestSummariesOperations +from ._test_summary_operations import TestSummaryOperations +from ._test_results_operations import TestResultsOperations +from ._test_result_operations import TestResultOperations +from ._os_updates_operations import OSUpdatesOperations +from ._os_update_operations import OSUpdateOperations +from ._favorite_processes_operations import FavoriteProcessesOperations +from ._favorite_process_operations import FavoriteProcessOperations +from ._analysis_results_operations import AnalysisResultsOperations +from ._analysis_result_operations import AnalysisResultOperations +from ._operations import Operations + +__all__ = [ + 'SKUsOperations', + 'TestBaseAccountsOperations', + 'TestBaseAccountOperations', + 'TestBaseAccountUsageOperations', + 'RESTAPIForTestBaseOperationsMixin', + 'TestBaseAccountAvailableOSsOperations', + 'TestBaseAccountAvailableOSOperations', + 'TestBaseAccountFlightingRingsOperations', + 'TestBaseAccountFlightingRingOperations', + 'TestBaseAccountTestTypesOperations', + 'TestBaseAccountTestTypeOperations', + 'PackagesOperations', + 'PackageOperations', + 'TestSummariesOperations', + 'TestSummaryOperations', + 'TestResultsOperations', + 'TestResultOperations', + 'OSUpdatesOperations', + 'OSUpdateOperations', + 'FavoriteProcessesOperations', + 'FavoriteProcessOperations', + 'AnalysisResultsOperations', + 'AnalysisResultOperations', + 'Operations', +] diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_result_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_result_operations.py new file mode 100644 index 000000000000..c05383a24352 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_result_operations.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, 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.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 AnalysisResultOperations: + """AnalysisResultOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + test_result_name: str, + analysis_result_name: Union[str, "_models.AnalysisResultName"], + **kwargs + ) -> "_models.AnalysisResultSingletonResource": + """Gets an Analysis Result of a Test Result by name. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :param analysis_result_name: The name of the Analysis Result of a Test Result. + :type analysis_result_name: str or ~restap_ifor_test_base.models.AnalysisResultName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResultSingletonResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.AnalysisResultSingletonResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalysisResultSingletonResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_name, 'str'), + 'analysisResultName': self._serialize.url("analysis_result_name", analysis_result_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AnalysisResultSingletonResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults/{analysisResultName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_results_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_results_operations.py new file mode 100644 index 000000000000..044bb6dd4497 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_results_operations.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AnalysisResultsOperations: + """AnalysisResultsOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + package_name: str, + test_result_name: str, + analysis_result_type: Union[str, "_models.AnalysisResultType"], + **kwargs + ) -> AsyncIterable["_models.AnalysisResultListResult"]: + """Lists the Analysis Results of a Test Result. The result collection will only contain one + element as all the data will be nested in a singleton object. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :param analysis_result_type: The type of the Analysis Result of a Test Result. + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AnalysisResultListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.AnalysisResultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalysisResultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['analysisResultType'] = self._serialize.query("analysis_result_type", analysis_result_type, '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('AnalysisResultListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_process_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_process_operations.py new file mode 100644 index 000000000000..9fac9e319e22 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_process_operations.py @@ -0,0 +1,253 @@ +# 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 FavoriteProcessOperations: + """FavoriteProcessOperations 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: ~restap_ifor_test_base.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 create( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + favorite_process_resource_name: str, + parameters: "_models.FavoriteProcessResource", + **kwargs + ) -> "_models.FavoriteProcessResource": + """Create or replace a favorite process for a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param favorite_process_resource_name: The resource name of a favorite process in a package. If + the process name contains characters that are not allowed in Azure Resource Name, we use + 'actualProcessName' in request body to submit the name. + :type favorite_process_resource_name: str + :param parameters: Parameters supplied to create a favorite process in a package. + :type parameters: ~restap_ifor_test_base.models.FavoriteProcessResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FavoriteProcessResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.FavoriteProcessResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FavoriteProcessResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'favoriteProcessResourceName': self._serialize.url("favorite_process_resource_name", favorite_process_resource_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(parameters, 'FavoriteProcessResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FavoriteProcessResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + favorite_process_resource_name: str, + **kwargs + ) -> None: + """Deletes a favorite process for a specific package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param favorite_process_resource_name: The resource name of a favorite process in a package. If + the process name contains characters that are not allowed in Azure Resource Name, we use + 'actualProcessName' in request body to submit the name. + :type favorite_process_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'favoriteProcessResourceName': self._serialize.url("favorite_process_resource_name", favorite_process_resource_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) + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + favorite_process_resource_name: str, + **kwargs + ) -> "_models.FavoriteProcessResource": + """Gets a favorite process for a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param favorite_process_resource_name: The resource name of a favorite process in a package. If + the process name contains characters that are not allowed in Azure Resource Name, we use + 'actualProcessName' in request body to submit the name. + :type favorite_process_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FavoriteProcessResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.FavoriteProcessResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FavoriteProcessResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'favoriteProcessResourceName': self._serialize.url("favorite_process_resource_name", favorite_process_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FavoriteProcessResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_processes_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_processes_operations.py new file mode 100644 index 000000000000..c0bb600a864c --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_processes_operations.py @@ -0,0 +1,121 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 FavoriteProcessesOperations: + """FavoriteProcessesOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + package_name: str, + **kwargs + ) -> AsyncIterable["_models.FavoriteProcessListResult"]: + """Lists the favorite processes for a specific package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FavoriteProcessListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.FavoriteProcessListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FavoriteProcessListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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') + + 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('FavoriteProcessListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_operations.py new file mode 100644 index 000000000000..7ade117f712a --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_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 Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~restap_ifor_test_base.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.OperationListResult"]: + """Lists all of the available REST API operations of the Microsoft.TestBase provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('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.TestBase/operations'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_update_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_update_operations.py new file mode 100644 index 000000000000..7a97be6652ac --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_update_operations.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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 OSUpdateOperations: + """OSUpdateOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + os_update_resource_name: str, + **kwargs + ) -> "_models.OSUpdateResource": + """Gets an OS Update by name in which the package was tested before. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param os_update_resource_name: The resource name of an OS Update. + :type os_update_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSUpdateResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.OSUpdateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OSUpdateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'osUpdateResourceName': self._serialize.url("os_update_resource_name", os_update_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OSUpdateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates/{osUpdateResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_updates_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_updates_operations.py new file mode 100644 index 000000000000..977b86e76e29 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_updates_operations.py @@ -0,0 +1,125 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OSUpdatesOperations: + """OSUpdatesOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + package_name: str, + os_update_type: Union[str, "_models.OsUpdateType"], + **kwargs + ) -> AsyncIterable["_models.OSUpdateListResult"]: + """Lists the OS Updates in which the package were tested before. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param os_update_type: The type of the OS Update. + :type os_update_type: str or ~restap_ifor_test_base.models.OsUpdateType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OSUpdateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.OSUpdateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OSUpdateListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['osUpdateType'] = self._serialize.query("os_update_type", os_update_type, '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('OSUpdateListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_package_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_package_operations.py new file mode 100644 index 000000000000..b4806337ecbf --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_package_operations.py @@ -0,0 +1,629 @@ +# 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 PackageOperations: + """PackageOperations 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: ~restap_ifor_test_base.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 _create_initial( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + parameters: "_models.PackageResource", + **kwargs + ) -> "_models.PackageResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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(parameters, 'PackageResource') + 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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('PackageResource', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PackageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + parameters: "_models.PackageResource", + **kwargs + ) -> AsyncLROPoller["_models.PackageResource"]: + """Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param parameters: Parameters supplied to create a Test Base Package. + :type parameters: ~restap_ifor_test_base.models.PackageResource + :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 PackageResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~restap_ifor_test_base.models.PackageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageResource"] + 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_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + package_name=package_name, + parameters=parameters, + 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('PackageResource', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + parameters: "_models.PackageUpdateParameters", + **kwargs + ) -> Optional["_models.PackageResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PackageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + 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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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(parameters, 'PackageUpdateParameters') + 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, 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) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PackageResource', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + parameters: "_models.PackageUpdateParameters", + **kwargs + ) -> AsyncLROPoller["_models.PackageResource"]: + """Update an existing Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param parameters: Parameters supplied to update a Test Base Package. + :type parameters: ~restap_ifor_test_base.models.PackageUpdateParameters + :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 PackageResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~restap_ifor_test_base.models.PackageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageResource"] + 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, + test_base_account_name=test_base_account_name, + package_name=package_name, + parameters=parameters, + 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('PackageResource', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + test_base_account_name: str, + package_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 = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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, 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) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_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, + test_base_account_name=test_base_account_name, + package_name=package_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + **kwargs + ) -> "_models.PackageResource": + """Gets a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PackageResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.PackageResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PackageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + async def _hard_delete_initial( + self, + resource_group_name: str, + test_base_account_name: str, + package_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 = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self._hard_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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, 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) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _hard_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete'} # type: ignore + + async def begin_hard_delete( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Hard Delete a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_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._hard_delete_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + package_name=package_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_hard_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_packages_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_packages_operations.py new file mode 100644 index 000000000000..2131e6646f26 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_packages_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 PackagesOperations: + """PackagesOperations 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: ~restap_ifor_test_base.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_test_base_account( + self, + resource_group_name: str, + test_base_account_name: str, + **kwargs + ) -> AsyncIterable["_models.PackageListResult"]: + """Lists all the packages under a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PackageListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.PackageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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_test_base_account.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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') + + 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('PackageListResult', 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_test_base_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_restap_ifor_test_base_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_restap_ifor_test_base_operations.py new file mode 100644 index 000000000000..814b8f8668df --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_restap_ifor_test_base_operations.py @@ -0,0 +1,356 @@ +# 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 RESTAPIForTestBaseOperationsMixin: + + async def test_base_account_get_file_upload_url( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: Optional["_models.GetFileUploadURLParameters"] = None, + **kwargs + ) -> "_models.FileUploadURLResponse": + """Gets the file upload URL of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param parameters: Parameters supplied to the Test Base Account GetFileUploadURL operation. + :type parameters: ~restap_ifor_test_base.models.GetFileUploadURLParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileUploadURLResponse, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.FileUploadURLResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileUploadURLResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_base_account_get_file_upload_url.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'GetFileUploadURLParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileUploadURLResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_base_account_get_file_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFileUploadUrl'} # type: ignore + + async def check_package_name_availability( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: "_models.PackageCheckNameAvailabilityParameters", + **kwargs + ) -> "_models.CheckNameAvailabilityResult": + """Checks that the Test Base Package name and version is valid and is not already in use. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param parameters: Parameters supplied to the Test Base Package CheckNameAvailability + operation. + :type parameters: ~restap_ifor_test_base.models.PackageCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_package_name_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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['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(parameters, 'PackageCheckNameAvailabilityParameters') + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_package_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkPackageNameAvailability'} # type: ignore + + async def package_get_download_url( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + **kwargs + ) -> "_models.DownloadURLResponse": + """Gets the download URL of a package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DownloadURLResponse, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.DownloadURLResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DownloadURLResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self.package_get_download_url.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DownloadURLResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + package_get_download_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/getDownloadUrl'} # type: ignore + + async def test_result_get_download_url( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + test_result_name: str, + **kwargs + ) -> "_models.DownloadURLResponse": + """Gets the download URL or the test result. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DownloadURLResponse, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.DownloadURLResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DownloadURLResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self.test_result_get_download_url.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DownloadURLResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_result_get_download_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getDownloadUrl'} # type: ignore + + async def test_result_get_video_download_url( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + test_result_name: str, + **kwargs + ) -> "_models.DownloadURLResponse": + """Gets the download URL of the test execution screen recording. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DownloadURLResponse, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.DownloadURLResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DownloadURLResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self.test_result_get_video_download_url.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DownloadURLResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_result_get_video_download_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getVideoDownloadUrl'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_skus_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_skus_operations.py new file mode 100644 index 000000000000..b8a869aa1796 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_skus_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 SKUsOperations: + """SKUsOperations 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: ~restap_ifor_test_base.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.TestBaseAccountSKUListResult"]: + """Lists the available SKUs of Test Base Account in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestBaseAccountSKUListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.TestBaseAccountSKUListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountSKUListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TestBaseAccountSKUListResult', 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': '/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/skus'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_available_os_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_available_os_operations.py new file mode 100644 index 000000000000..c63c343e39e6 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_available_os_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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 TestBaseAccountAvailableOSOperations: + """TestBaseAccountAvailableOSOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + available_os_resource_name: str, + **kwargs + ) -> "_models.AvailableOSResource": + """Gets an available OS to run a package under a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param available_os_resource_name: The resource name of an Available OS. + :type available_os_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableOSResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.AvailableOSResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOSResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'availableOSResourceName': self._serialize.url("available_os_resource_name", available_os_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableOSResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs/{availableOSResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_available_oss_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_available_oss_operations.py new file mode 100644 index 000000000000..e54a11bfd000 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_available_oss_operations.py @@ -0,0 +1,121 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TestBaseAccountAvailableOSsOperations: + """TestBaseAccountAvailableOSsOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + os_update_type: Union[str, "_models.OsUpdateType"], + **kwargs + ) -> AsyncIterable["_models.AvailableOSListResult"]: + """Lists all the available OSs to run a package under a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param os_update_type: The type of the OS Update. + :type os_update_type: str or ~restap_ifor_test_base.models.OsUpdateType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOSListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.AvailableOSListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOSListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['osUpdateType'] = self._serialize.query("os_update_type", os_update_type, '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('AvailableOSListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_flighting_ring_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_flighting_ring_operations.py new file mode 100644 index 000000000000..842556507efe --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_flighting_ring_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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 TestBaseAccountFlightingRingOperations: + """TestBaseAccountFlightingRingOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + flighting_ring_resource_name: str, + **kwargs + ) -> "_models.FlightingRingResource": + """Gets a flighting ring of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param flighting_ring_resource_name: The resource name of a flighting ring. + :type flighting_ring_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FlightingRingResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.FlightingRingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FlightingRingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'flightingRingResourceName': self._serialize.url("flighting_ring_resource_name", flighting_ring_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FlightingRingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings/{flightingRingResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_flighting_rings_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_flighting_rings_operations.py new file mode 100644 index 000000000000..a47c78e92278 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_flighting_rings_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 TestBaseAccountFlightingRingsOperations: + """TestBaseAccountFlightingRingsOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + **kwargs + ) -> AsyncIterable["_models.FlightingRingListResult"]: + """Lists all the flighting rings of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FlightingRingListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.FlightingRingListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FlightingRingListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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') + + 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('FlightingRingListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_operations.py new file mode 100644 index 000000000000..e17f0d5e2142 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_operations.py @@ -0,0 +1,606 @@ +# 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 TestBaseAccountOperations: + """TestBaseAccountOperations 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: ~restap_ifor_test_base.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 _create_initial( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: "_models.TestBaseAccountResource", + restore: Optional[bool] = None, + **kwargs + ) -> "_models.TestBaseAccountResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if restore is not None: + query_parameters['restore'] = self._serialize.query("restore", restore, 'bool') + 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(parameters, 'TestBaseAccountResource') + 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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('TestBaseAccountResource', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('TestBaseAccountResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: "_models.TestBaseAccountResource", + restore: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller["_models.TestBaseAccountResource"]: + """Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the + specified subscription. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param parameters: Parameters supplied to create a Test Base Account. + :type parameters: ~restap_ifor_test_base.models.TestBaseAccountResource + :param restore: The flag indicating if we would like to restore the Test Base Accounts which + were soft deleted before. + :type restore: bool + :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 TestBaseAccountResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~restap_ifor_test_base.models.TestBaseAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountResource"] + 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_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + parameters=parameters, + restore=restore, + 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('TestBaseAccountResource', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: "_models.TestBaseAccountUpdateParameters", + **kwargs + ) -> Optional["_models.TestBaseAccountResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TestBaseAccountResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + 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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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['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(parameters, 'TestBaseAccountUpdateParameters') + 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, 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) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TestBaseAccountResource', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: "_models.TestBaseAccountUpdateParameters", + **kwargs + ) -> AsyncLROPoller["_models.TestBaseAccountResource"]: + """Update an existing Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param parameters: Parameters supplied to update a Test Base Account. + :type parameters: ~restap_ifor_test_base.models.TestBaseAccountUpdateParameters + :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 TestBaseAccountResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~restap_ifor_test_base.models.TestBaseAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountResource"] + 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, + test_base_account_name=test_base_account_name, + parameters=parameters, + 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('TestBaseAccountResource', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + test_base_account_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 = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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.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) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + test_base_account_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_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, + test_base_account_name=test_base_account_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + **kwargs + ) -> "_models.TestBaseAccountResource": + """Gets a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestBaseAccountResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.TestBaseAccountResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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.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('TestBaseAccountResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + async def _offboard_initial( + self, + resource_group_name: str, + test_base_account_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 = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self._offboard_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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 + + 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) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _offboard_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard'} # type: ignore + + async def begin_offboard( + self, + resource_group_name: str, + test_base_account_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Offboard a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_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._offboard_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_offboard.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_test_type_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_test_type_operations.py new file mode 100644 index 000000000000..f4a28777ffe5 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_test_type_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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 TestBaseAccountTestTypeOperations: + """TestBaseAccountTestTypeOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + test_type_resource_name: str, + **kwargs + ) -> "_models.TestTypeResource": + """Gets a test type of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param test_type_resource_name: The resource name of a test type. + :type test_type_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestTypeResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.TestTypeResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestTypeResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'testTypeResourceName': self._serialize.url("test_type_resource_name", test_type_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestTypeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes/{testTypeResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_test_types_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_test_types_operations.py new file mode 100644 index 000000000000..125ab4cd21c0 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_test_types_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 TestBaseAccountTestTypesOperations: + """TestBaseAccountTestTypesOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + **kwargs + ) -> AsyncIterable["_models.TestTypeListResult"]: + """Lists all the test types of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestTypeListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.TestTypeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestTypeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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') + + 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('TestTypeListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_usage_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_usage_operations.py new file mode 100644 index 000000000000..d46b89f1d962 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_account_usage_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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 TestBaseAccountUsageOperations: + """TestBaseAccountUsageOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.TestBaseAccountUsageDataList"]: + """Lists the usage data of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param filter: Odata filter. + :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 TestBaseAccountUsageDataList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.TestBaseAccountUsageDataList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountUsageDataList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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('TestBaseAccountUsageDataList', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/usages'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_accounts_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_accounts_operations.py new file mode 100644 index 000000000000..1f45e1dd9526 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_accounts_operations.py @@ -0,0 +1,192 @@ +# 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 TestBaseAccountsOperations: + """TestBaseAccountsOperations 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: ~restap_ifor_test_base.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_subscription( + self, + get_deleted: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["_models.TestBaseAccountListResult"]: + """Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + + :param get_deleted: The flag indicating if we need to include the Test Base Accounts which were + soft deleted before. + :type get_deleted: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestBaseAccountListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.TestBaseAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if get_deleted is not None: + query_parameters['getDeleted'] = self._serialize.query("get_deleted", get_deleted, 'bool') + 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('TestBaseAccountListResult', 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.TestBase/testBaseAccounts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + get_deleted: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["_models.TestBaseAccountListResult"]: + """Lists all the Test Base Accounts in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param get_deleted: The flag indicating if we need to include the Test Base Accounts which were + soft deleted before. + :type get_deleted: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestBaseAccountListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.TestBaseAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if get_deleted is not None: + query_parameters['getDeleted'] = self._serialize.query("get_deleted", get_deleted, 'bool') + 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('TestBaseAccountListResult', 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_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_result_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_result_operations.py new file mode 100644 index 000000000000..37aec42601ee --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_result_operations.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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 TestResultOperations: + """TestResultOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: str, + test_result_name: str, + **kwargs + ) -> "_models.TestResultResource": + """Get the Test Result by Id with specified OS Update type for a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestResultResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.TestResultResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestResultResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestResultResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_results_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_results_operations.py new file mode 100644 index 000000000000..d722d7abd7bf --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_results_operations.py @@ -0,0 +1,131 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TestResultsOperations: + """TestResultsOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + package_name: str, + os_update_type: Union[str, "_models.OsUpdateType"], + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.TestResultListResult"]: + """Lists all the Test Results with specified OS Update type for a Test Base Package. Can be + filtered by osName, releaseName, flightingRing, buildVersion, buildRevision. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param os_update_type: The type of the OS Update. + :type os_update_type: str or ~restap_ifor_test_base.models.OsUpdateType + :param filter: Odata filter. + :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 TestResultListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.TestResultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestResultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['osUpdateType'] = self._serialize.query("os_update_type", os_update_type, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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('TestResultListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summaries_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summaries_operations.py new file mode 100644 index 000000000000..4d34b17382d7 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summaries_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 TestSummariesOperations: + """TestSummariesOperations 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: ~restap_ifor_test_base.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, + test_base_account_name: str, + **kwargs + ) -> AsyncIterable["_models.TestSummaryListResult"]: + """Lists the Test Summaries of all the packages under a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestSummaryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~restap_ifor_test_base.models.TestSummaryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestSummaryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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') + + 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('TestSummaryListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summary_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summary_operations.py new file mode 100644 index 000000000000..20ea5c00d6fc --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summary_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 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 TestSummaryOperations: + """TestSummaryOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + test_summary_name: str, + **kwargs + ) -> "_models.TestSummaryResource": + """Gets a Test Summary with specific name from all the Test Summaries of all the packages under a + Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param test_summary_name: The name of the Test Summary. + :type test_summary_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestSummaryResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.TestSummaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestSummaryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'testSummaryName': self._serialize.url("test_summary_name", test_summary_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestSummaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries/{testSummaryName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/__init__.py new file mode 100644 index 000000000000..6706bef8874e --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/__init__.py @@ -0,0 +1,237 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AnalysisResultListResult + from ._models_py3 import AnalysisResultSingletonResource + from ._models_py3 import AnalysisResultSingletonResourceProperties + from ._models_py3 import AvailableOSListResult + from ._models_py3 import AvailableOSResource + from ._models_py3 import CPURegressionResultSingletonResourceProperties + from ._models_py3 import CPUUtilizationResultSingletonResourceProperties + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import Command + from ._models_py3 import DownloadURLResponse + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse + from ._models_py3 import FavoriteProcessListResult + from ._models_py3 import FavoriteProcessResource + from ._models_py3 import FileUploadURLResponse + from ._models_py3 import FlightingRingListResult + from ._models_py3 import FlightingRingResource + from ._models_py3 import GetFileUploadURLParameters + from ._models_py3 import MemoryRegressionResultSingletonResourceProperties + from ._models_py3 import MemoryUtilizationResultSingletonResourceProperties + from ._models_py3 import OSUpdateListResult + from ._models_py3 import OSUpdateResource + from ._models_py3 import OSUpdateTestSummary + from ._models_py3 import OSUpdatesTestSummary + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import PackageCheckNameAvailabilityParameters + from ._models_py3 import PackageListResult + from ._models_py3 import PackageResource + from ._models_py3 import PackageUpdateParameters + from ._models_py3 import PackageValidationResult + from ._models_py3 import ProxyResource + from ._models_py3 import RegressionResult + from ._models_py3 import RegressionTestDetails + from ._models_py3 import ReliabilityResult + from ._models_py3 import ReliabilityResultSingletonResourceProperties + from ._models_py3 import Resource + from ._models_py3 import ScriptExecutionResult + from ._models_py3 import ScriptExecutionResultSingletonResourceProperties + from ._models_py3 import SystemData + from ._models_py3 import TargetOSInfo + from ._models_py3 import Test + from ._models_py3 import TestBaseAccountListResult + from ._models_py3 import TestBaseAccountResource + from ._models_py3 import TestBaseAccountSKU + from ._models_py3 import TestBaseAccountSKUCapability + from ._models_py3 import TestBaseAccountSKUListResult + from ._models_py3 import TestBaseAccountUpdateParameters + from ._models_py3 import TestBaseAccountUsageData + from ._models_py3 import TestBaseAccountUsageDataList + from ._models_py3 import TestBaseAccountUsageName + from ._models_py3 import TestResultAnalysisSummary + from ._models_py3 import TestResultListResult + from ._models_py3 import TestResultResource + from ._models_py3 import TestSummaryListResult + from ._models_py3 import TestSummaryResource + from ._models_py3 import TestTypeListResult + from ._models_py3 import TestTypeResource + from ._models_py3 import TrackedResource + from ._models_py3 import UtilizationBound + from ._models_py3 import UtilizationEntry + from ._models_py3 import UtilizationResult +except (SyntaxError, ImportError): + from ._models import AnalysisResultListResult # type: ignore + from ._models import AnalysisResultSingletonResource # type: ignore + from ._models import AnalysisResultSingletonResourceProperties # type: ignore + from ._models import AvailableOSListResult # type: ignore + from ._models import AvailableOSResource # type: ignore + from ._models import CPURegressionResultSingletonResourceProperties # type: ignore + from ._models import CPUUtilizationResultSingletonResourceProperties # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import Command # type: ignore + from ._models import DownloadURLResponse # type: ignore + from ._models import ErrorDefinition # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import FavoriteProcessListResult # type: ignore + from ._models import FavoriteProcessResource # type: ignore + from ._models import FileUploadURLResponse # type: ignore + from ._models import FlightingRingListResult # type: ignore + from ._models import FlightingRingResource # type: ignore + from ._models import GetFileUploadURLParameters # type: ignore + from ._models import MemoryRegressionResultSingletonResourceProperties # type: ignore + from ._models import MemoryUtilizationResultSingletonResourceProperties # type: ignore + from ._models import OSUpdateListResult # type: ignore + from ._models import OSUpdateResource # type: ignore + from ._models import OSUpdateTestSummary # type: ignore + from ._models import OSUpdatesTestSummary # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PackageCheckNameAvailabilityParameters # type: ignore + from ._models import PackageListResult # type: ignore + from ._models import PackageResource # type: ignore + from ._models import PackageUpdateParameters # type: ignore + from ._models import PackageValidationResult # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegressionResult # type: ignore + from ._models import RegressionTestDetails # type: ignore + from ._models import ReliabilityResult # type: ignore + from ._models import ReliabilityResultSingletonResourceProperties # type: ignore + from ._models import Resource # type: ignore + from ._models import ScriptExecutionResult # type: ignore + from ._models import ScriptExecutionResultSingletonResourceProperties # type: ignore + from ._models import SystemData # type: ignore + from ._models import TargetOSInfo # type: ignore + from ._models import Test # type: ignore + from ._models import TestBaseAccountListResult # type: ignore + from ._models import TestBaseAccountResource # type: ignore + from ._models import TestBaseAccountSKU # type: ignore + from ._models import TestBaseAccountSKUCapability # type: ignore + from ._models import TestBaseAccountSKUListResult # type: ignore + from ._models import TestBaseAccountUpdateParameters # type: ignore + from ._models import TestBaseAccountUsageData # type: ignore + from ._models import TestBaseAccountUsageDataList # type: ignore + from ._models import TestBaseAccountUsageName # type: ignore + from ._models import TestResultAnalysisSummary # type: ignore + from ._models import TestResultListResult # type: ignore + from ._models import TestResultResource # type: ignore + from ._models import TestSummaryListResult # type: ignore + from ._models import TestSummaryResource # type: ignore + from ._models import TestTypeListResult # type: ignore + from ._models import TestTypeResource # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UtilizationBound # type: ignore + from ._models import UtilizationEntry # type: ignore + from ._models import UtilizationResult # type: ignore + +from ._restap_ifor_test_base_enums import ( + Action, + AnalysisResultName, + AnalysisResultType, + AnalysisStatus, + ContentType, + CreatedByType, + ExecutionStatus, + Grade, + OsUpdateType, + PackageStatus, + ProvisioningState, + Reason, + TestType, + Tier, + Type, + ValidationRunStatus, +) + +__all__ = [ + 'AnalysisResultListResult', + 'AnalysisResultSingletonResource', + 'AnalysisResultSingletonResourceProperties', + 'AvailableOSListResult', + 'AvailableOSResource', + 'CPURegressionResultSingletonResourceProperties', + 'CPUUtilizationResultSingletonResourceProperties', + 'CheckNameAvailabilityResult', + 'Command', + 'DownloadURLResponse', + 'ErrorDefinition', + 'ErrorResponse', + 'FavoriteProcessListResult', + 'FavoriteProcessResource', + 'FileUploadURLResponse', + 'FlightingRingListResult', + 'FlightingRingResource', + 'GetFileUploadURLParameters', + 'MemoryRegressionResultSingletonResourceProperties', + 'MemoryUtilizationResultSingletonResourceProperties', + 'OSUpdateListResult', + 'OSUpdateResource', + 'OSUpdateTestSummary', + 'OSUpdatesTestSummary', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PackageCheckNameAvailabilityParameters', + 'PackageListResult', + 'PackageResource', + 'PackageUpdateParameters', + 'PackageValidationResult', + 'ProxyResource', + 'RegressionResult', + 'RegressionTestDetails', + 'ReliabilityResult', + 'ReliabilityResultSingletonResourceProperties', + 'Resource', + 'ScriptExecutionResult', + 'ScriptExecutionResultSingletonResourceProperties', + 'SystemData', + 'TargetOSInfo', + 'Test', + 'TestBaseAccountListResult', + 'TestBaseAccountResource', + 'TestBaseAccountSKU', + 'TestBaseAccountSKUCapability', + 'TestBaseAccountSKUListResult', + 'TestBaseAccountUpdateParameters', + 'TestBaseAccountUsageData', + 'TestBaseAccountUsageDataList', + 'TestBaseAccountUsageName', + 'TestResultAnalysisSummary', + 'TestResultListResult', + 'TestResultResource', + 'TestSummaryListResult', + 'TestSummaryResource', + 'TestTypeListResult', + 'TestTypeResource', + 'TrackedResource', + 'UtilizationBound', + 'UtilizationEntry', + 'UtilizationResult', + 'Action', + 'AnalysisResultName', + 'AnalysisResultType', + 'AnalysisStatus', + 'ContentType', + 'CreatedByType', + 'ExecutionStatus', + 'Grade', + 'OsUpdateType', + 'PackageStatus', + 'ProvisioningState', + 'Reason', + 'TestType', + 'Tier', + 'Type', + 'ValidationRunStatus', +] diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models.py new file mode 100644 index 000000000000..1e35b1cbd419 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models.py @@ -0,0 +1,2488 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AnalysisResultListResult(msrest.serialization.Model): + """A list of Analysis Results. It will only contain one element as all the data will be nested in a singleton object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Analysis Results. + :type value: list[~restap_ifor_test_base.models.AnalysisResultSingletonResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AnalysisResultSingletonResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AnalysisResultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class Resource(msrest.serialization.Model): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for an ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class AnalysisResultSingletonResource(ProxyResource): + """The Analysis Result Singleton Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Type of the Analysis Result.Constant filled by server. Possible + values include: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", + "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'grade': {'key': 'properties.grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'properties.analysisResultType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AnalysisResultSingletonResource, self).__init__(**kwargs) + self.system_data = None + self.grade = kwargs.get('grade', None) + self.analysis_result_type = None # type: Optional[str] + + +class AnalysisResultSingletonResourceProperties(msrest.serialization.Model): + """The properties of Analysis Result resource. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: CPURegressionResultSingletonResourceProperties, CPUUtilizationResultSingletonResourceProperties, MemoryRegressionResultSingletonResourceProperties, MemoryUtilizationResultSingletonResourceProperties, ReliabilityResultSingletonResourceProperties, ScriptExecutionResultSingletonResourceProperties. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + } + + _subtype_map = { + 'analysis_result_type': {'CPURegression': 'CPURegressionResultSingletonResourceProperties', 'CPUUtilization': 'CPUUtilizationResultSingletonResourceProperties', 'MemoryRegression': 'MemoryRegressionResultSingletonResourceProperties', 'MemoryUtilization': 'MemoryUtilizationResultSingletonResourceProperties', 'Reliability': 'ReliabilityResultSingletonResourceProperties', 'ScriptExecution': 'ScriptExecutionResultSingletonResourceProperties'} + } + + def __init__( + self, + **kwargs + ): + super(AnalysisResultSingletonResourceProperties, self).__init__(**kwargs) + self.grade = kwargs.get('grade', None) + self.analysis_result_type = None # type: Optional[str] + + +class AvailableOSListResult(msrest.serialization.Model): + """A list of available OSs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of available OSs. + :type value: list[~restap_ifor_test_base.models.AvailableOSResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AvailableOSResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOSListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class AvailableOSResource(ProxyResource): + """The Available OS resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param os_id: The Id of an Available OS of a Test Base Account. + :type os_id: str + :param os_name: The name of an Available OS of a Test Base Account. + :type os_name: str + :param os_version: The version of an Available OS of a Test Base Account. + :type os_version: str + :param insider_channel: The insider channel of an Available OS of a Test Base Account. + :type insider_channel: str + :param os_update_type: The OS update type of an Available OS of a Test Base Account. + :type os_update_type: str + :param os_platform: The Platform of an Available OS of a Test Base Account. + :type os_platform: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'os_id': {'key': 'properties.osId', 'type': 'str'}, + 'os_name': {'key': 'properties.osName', 'type': 'str'}, + 'os_version': {'key': 'properties.osVersion', 'type': 'str'}, + 'insider_channel': {'key': 'properties.insiderChannel', 'type': 'str'}, + 'os_update_type': {'key': 'properties.osUpdateType', 'type': 'str'}, + 'os_platform': {'key': 'properties.osPlatform', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOSResource, self).__init__(**kwargs) + self.system_data = None + self.os_id = kwargs.get('os_id', None) + self.os_name = kwargs.get('os_name', None) + self.os_version = kwargs.get('os_version', None) + self.insider_channel = kwargs.get('insider_channel', None) + self.os_update_type = kwargs.get('os_update_type', None) + self.os_platform = kwargs.get('os_platform', None) + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability response properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name_available: Value indicating the availability of the name: true if the name is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a name. Required if nameAvailable == false. + Possible values include: "Invalid", "AlreadyExists". + :type reason: str or ~restap_ifor_test_base.models.Reason + :ivar message: The detailed info regarding the reason associated with the name. Required if + nameAvailable == false. + :vartype message: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = None + + +class Command(msrest.serialization.Model): + """The command used in the test. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the command. + :type name: str + :param action: Required. The action of the command. Possible values include: "Install", + "Launch", "Close", "Uninstall", "Custom". + :type action: str or ~restap_ifor_test_base.models.Action + :param content_type: Required. The type of command content. Possible values include: "Inline", + "File", "Path". + :type content_type: str or ~restap_ifor_test_base.models.ContentType + :param content: Required. The content of the command. The content depends on source type. + :type content: str + :param run_elevated: Specifies whether to run the command as administrator. + :type run_elevated: bool + :param restart_after: Specifies whether to restart the VM after the command executed. + :type restart_after: bool + :param max_run_time: Specifies the max run time of the command. + :type max_run_time: int + :param run_as_interactive: Specifies whether to run the command in interactive mode. + :type run_as_interactive: bool + :param always_run: Specifies whether to run the command even if a previous command is failed. + :type always_run: bool + :param apply_update_before: Specifies whether to apply update before the command. + :type apply_update_before: bool + """ + + _validation = { + 'name': {'required': True}, + 'action': {'required': True}, + 'content_type': {'required': True}, + 'content': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'content': {'key': 'content', 'type': 'str'}, + 'run_elevated': {'key': 'runElevated', 'type': 'bool'}, + 'restart_after': {'key': 'restartAfter', 'type': 'bool'}, + 'max_run_time': {'key': 'maxRunTime', 'type': 'int'}, + 'run_as_interactive': {'key': 'runAsInteractive', 'type': 'bool'}, + 'always_run': {'key': 'alwaysRun', 'type': 'bool'}, + 'apply_update_before': {'key': 'applyUpdateBefore', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Command, self).__init__(**kwargs) + self.name = kwargs['name'] + self.action = kwargs['action'] + self.content_type = kwargs['content_type'] + self.content = kwargs['content'] + self.run_elevated = kwargs.get('run_elevated', None) + self.restart_after = kwargs.get('restart_after', None) + self.max_run_time = kwargs.get('max_run_time', None) + self.run_as_interactive = kwargs.get('run_as_interactive', None) + self.always_run = kwargs.get('always_run', None) + self.apply_update_before = kwargs.get('apply_update_before', None) + + +class CPURegressionResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of CPU Regression Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param cpu_regression_results: The result array data. + :type cpu_regression_results: list[~restap_ifor_test_base.models.RegressionResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'cpu_regression_results': {'key': 'cpuRegressionResults', 'type': '[RegressionResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(CPURegressionResultSingletonResourceProperties, self).__init__(**kwargs) + self.analysis_result_type = 'CPURegression' # type: str + self.cpu_regression_results = kwargs.get('cpu_regression_results', None) + + +class CPUUtilizationResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of CPU Utilization Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param cpu_utilization_results: The result array data. + :type cpu_utilization_results: list[~restap_ifor_test_base.models.UtilizationResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'cpu_utilization_results': {'key': 'cpuUtilizationResults', 'type': '[UtilizationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(CPUUtilizationResultSingletonResourceProperties, self).__init__(**kwargs) + self.analysis_result_type = 'CPUUtilization' # type: str + self.cpu_utilization_results = kwargs.get('cpu_utilization_results', None) + + +class DownloadURLResponse(msrest.serialization.Model): + """The response of getting a download URL. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar download_url: The download URL. + :vartype download_url: str + :ivar expiration_time: Expiry date of the download URL. + :vartype expiration_time: ~datetime.datetime + """ + + _validation = { + 'download_url': {'readonly': True}, + 'expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'download_url': {'key': 'downloadUrl', 'type': 'str'}, + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(DownloadURLResponse, self).__init__(**kwargs) + self.download_url = None + self.expiration_time = None + + +class ErrorDefinition(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~restap_ifor_test_base.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + + +class ErrorResponse(msrest.serialization.Model): + """The error response send when an operation fails. + + :param error: The error details. + :type error: ~restap_ifor_test_base.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class FavoriteProcessListResult(msrest.serialization.Model): + """A list of favorite processes for a package. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of favorite processes for a package. + :type value: list[~restap_ifor_test_base.models.FavoriteProcessResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FavoriteProcessResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FavoriteProcessListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class FavoriteProcessResource(ProxyResource): + """A favorite process identifier. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param actual_process_name: The actual name of the favorite process. It will be equal to + resource name except for the scenario that the process name contains characters that are not + allowed in the resource name. + :type actual_process_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'actual_process_name': {'key': 'properties.actualProcessName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FavoriteProcessResource, self).__init__(**kwargs) + self.system_data = None + self.actual_process_name = kwargs.get('actual_process_name', None) + + +class FileUploadURLResponse(msrest.serialization.Model): + """The URL response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar upload_url: The URL used for uploading the package. + :vartype upload_url: str + :ivar blob_path: The blob path of the uploaded package. It will be used as the 'blobPath' + property of PackageResource. + :vartype blob_path: str + """ + + _validation = { + 'upload_url': {'readonly': True}, + 'blob_path': {'readonly': True}, + } + + _attribute_map = { + 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, + 'blob_path': {'key': 'blobPath', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FileUploadURLResponse, self).__init__(**kwargs) + self.upload_url = None + self.blob_path = None + + +class FlightingRingListResult(msrest.serialization.Model): + """A list of flighting rings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of flighting rings. + :type value: list[~restap_ifor_test_base.models.FlightingRingResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FlightingRingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FlightingRingListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class FlightingRingResource(ProxyResource): + """The flighting ring resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param actual_flighting_ring_name: The actual name of a flighting ring of a Test Base Account. + :type actual_flighting_ring_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'actual_flighting_ring_name': {'key': 'properties.actualFlightingRingName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FlightingRingResource, self).__init__(**kwargs) + self.system_data = None + self.actual_flighting_ring_name = kwargs.get('actual_flighting_ring_name', None) + + +class GetFileUploadURLParameters(msrest.serialization.Model): + """The parameters supplied to the Test Base Account GetFileUploadURL action. + + :param blob_name: The custom file name of the uploaded blob. + :type blob_name: str + """ + + _attribute_map = { + 'blob_name': {'key': 'blobName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GetFileUploadURLParameters, self).__init__(**kwargs) + self.blob_name = kwargs.get('blob_name', None) + + +class MemoryRegressionResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of Memory Regression Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param memory_regression_results: The result array data. + :type memory_regression_results: list[~restap_ifor_test_base.models.RegressionResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'memory_regression_results': {'key': 'memoryRegressionResults', 'type': '[RegressionResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(MemoryRegressionResultSingletonResourceProperties, self).__init__(**kwargs) + self.analysis_result_type = 'MemoryRegression' # type: str + self.memory_regression_results = kwargs.get('memory_regression_results', None) + + +class MemoryUtilizationResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of Memory Utilization Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param memory_utilization_results: The result array data. + :type memory_utilization_results: list[~restap_ifor_test_base.models.UtilizationResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'memory_utilization_results': {'key': 'memoryUtilizationResults', 'type': '[UtilizationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(MemoryUtilizationResultSingletonResourceProperties, self).__init__(**kwargs) + self.analysis_result_type = 'MemoryUtilization' # type: str + self.memory_utilization_results = kwargs.get('memory_utilization_results', None) + + +class Operation(msrest.serialization.Model): + """REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar origin: Origin of the operation. + :vartype origin: str + :param display: The object that describes the operation. + :type display: ~restap_ifor_test_base.models.OperationDisplay + :param properties: Extra properties of the operation. + :type properties: str + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'properties': {'key': 'properties', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.origin = None + self.display = kwargs.get('display', None) + self.properties = kwargs.get('properties', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The resource provider name: Microsoft.TestBase. + :vartype provider: str + :ivar operation: Operation type: read, write, delete, listPackages, etc. + :vartype operation: str + :ivar resource: Resource type on which the operation is performed. + :vartype resource: str + :ivar description: Friendly name of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.operation = None + self.resource = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of operations supported by the resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of operations supported by the Test Base resource provider. + :type value: list[~restap_ifor_test_base.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class OSUpdateListResult(msrest.serialization.Model): + """A list of OS Updates. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of OS Updates. + :type value: list[~restap_ifor_test_base.models.OSUpdateResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OSUpdateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OSUpdateListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class OSUpdateResource(ProxyResource): + """An OS Update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param os_name: The name of the OS. + :type os_name: str + :param release: The name of tested release. + :type release: str + :param flighting_ring: The flighting ring, only for release of feature updates. + :type flighting_ring: str + :param build_version: The build version of the tested release (OS update). + :type build_version: str + :param build_revision: The build revision of the tested release (OS update). + :type build_revision: str + :param type_properties_type: The type of this release (OS update). Possible values include: + "SecurityUpdate", "FeatureUpdate". + :type type_properties_type: str or ~restap_ifor_test_base.models.Type + :param release_version_date: The release version date the tested release (OS update). + :type release_version_date: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'os_name': {'key': 'properties.osName', 'type': 'str'}, + 'release': {'key': 'properties.release', 'type': 'str'}, + 'flighting_ring': {'key': 'properties.flightingRing', 'type': 'str'}, + 'build_version': {'key': 'properties.buildVersion', 'type': 'str'}, + 'build_revision': {'key': 'properties.buildRevision', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'release_version_date': {'key': 'properties.releaseVersionDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(OSUpdateResource, self).__init__(**kwargs) + self.system_data = None + self.os_name = kwargs.get('os_name', None) + self.release = kwargs.get('release', None) + self.flighting_ring = kwargs.get('flighting_ring', None) + self.build_version = kwargs.get('build_version', None) + self.build_revision = kwargs.get('build_revision', None) + self.type_properties_type = kwargs.get('type_properties_type', None) + self.release_version_date = kwargs.get('release_version_date', None) + + +class OSUpdatesTestSummary(msrest.serialization.Model): + """The summary of some tests. + + :param execution_status: The status of the last test. Possible values include: "None", + "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", "Succeeded". + :type execution_status: str or ~restap_ifor_test_base.models.ExecutionStatus + :param grade: The grade of last test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param test_run_time: The run time of the last test. + :type test_run_time: str + :param os_update_test_summaries: Detailed summary for each OS update. + :type os_update_test_summaries: list[~restap_ifor_test_base.models.OSUpdateTestSummary] + """ + + _attribute_map = { + 'execution_status': {'key': 'executionStatus', 'type': 'str'}, + 'grade': {'key': 'grade', 'type': 'str'}, + 'test_run_time': {'key': 'testRunTime', 'type': 'str'}, + 'os_update_test_summaries': {'key': 'osUpdateTestSummaries', 'type': '[OSUpdateTestSummary]'}, + } + + def __init__( + self, + **kwargs + ): + super(OSUpdatesTestSummary, self).__init__(**kwargs) + self.execution_status = kwargs.get('execution_status', None) + self.grade = kwargs.get('grade', None) + self.test_run_time = kwargs.get('test_run_time', None) + self.os_update_test_summaries = kwargs.get('os_update_test_summaries', None) + + +class OSUpdateTestSummary(msrest.serialization.Model): + """The summary of a test. + + :param os_name: The operating system name. e.g. Windows 10 1809. + :type os_name: str + :param release_name: The name of the tested release (OS update). + :type release_name: str + :param build_version: The build version of the tested release (OS update). + :type build_version: str + :param build_revision: The build revision of the tested release (OS update). + :type build_revision: str + :param release_version_date: The release version date. + :type release_version_date: ~datetime.datetime + :param flighting_ring: The flighting ring, only for release of feature updates. + :type flighting_ring: str + :param execution_status: The execution status of the test. Possible values include: "None", + "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", "Succeeded". + :type execution_status: str or ~restap_ifor_test_base.models.ExecutionStatus + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param test_run_time: The run time of the test. + :type test_run_time: str + :param test_type: The test type of the package. + :type test_type: str + """ + + _attribute_map = { + 'os_name': {'key': 'osName', 'type': 'str'}, + 'release_name': {'key': 'releaseName', 'type': 'str'}, + 'build_version': {'key': 'buildVersion', 'type': 'str'}, + 'build_revision': {'key': 'buildRevision', 'type': 'str'}, + 'release_version_date': {'key': 'releaseVersionDate', 'type': 'iso-8601'}, + 'flighting_ring': {'key': 'flightingRing', 'type': 'str'}, + 'execution_status': {'key': 'executionStatus', 'type': 'str'}, + 'grade': {'key': 'grade', 'type': 'str'}, + 'test_run_time': {'key': 'testRunTime', 'type': 'str'}, + 'test_type': {'key': 'testType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OSUpdateTestSummary, self).__init__(**kwargs) + self.os_name = kwargs.get('os_name', None) + self.release_name = kwargs.get('release_name', None) + self.build_version = kwargs.get('build_version', None) + self.build_revision = kwargs.get('build_revision', None) + self.release_version_date = kwargs.get('release_version_date', None) + self.flighting_ring = kwargs.get('flighting_ring', None) + self.execution_status = kwargs.get('execution_status', None) + self.grade = kwargs.get('grade', None) + self.test_run_time = kwargs.get('test_run_time', None) + self.test_type = kwargs.get('test_type', None) + + +class PackageCheckNameAvailabilityParameters(msrest.serialization.Model): + """Parameters body to pass for Test Base Package name availability check. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name to verify. + :type name: str + :param application_name: Required. Application name to verify. + :type application_name: str + :param version: Required. Version name to verify. + :type version: str + :param type: Required. fully qualified resource type which includes provider namespace. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'application_name': {'required': True}, + 'version': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'application_name': {'key': 'applicationName', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PackageCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = kwargs['name'] + self.application_name = kwargs['application_name'] + self.version = kwargs['version'] + self.type = kwargs['type'] + + +class PackageListResult(msrest.serialization.Model): + """A list of Test Base Packages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Base Packages. + :type value: list[~restap_ifor_test_base.models.PackageResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PackageResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PackageListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TrackedResource(Resource): + """The resource model definition for an ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + self.etag = None + + +class PackageResource(TrackedResource): + """The Test Base Package resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", "Updating". + :vartype provisioning_state: str or ~restap_ifor_test_base.models.ProvisioningState + :param application_name: Application name. + :type application_name: str + :param version: Application version. + :type version: str + :ivar test_types: OOB, functional or both. Mapped to the data in 'tests' property. + :vartype test_types: list[str or ~restap_ifor_test_base.models.TestType] + :param target_os_list: Specifies the target OSs of specific OS Update types. + :type target_os_list: list[~restap_ifor_test_base.models.TargetOSInfo] + :ivar package_status: The status of the package. Possible values include: "Unknown", + "Registered", "Ready", "Error", "ValidatingPackage", "PreValidationCheckPass", "Deleted", + "ValidationLongerThanUsual", "VerifyingPackage". + :vartype package_status: str or ~restap_ifor_test_base.models.PackageStatus + :ivar last_modified_time: The UTC timestamp when the package was last modified. + :vartype last_modified_time: ~datetime.datetime + :param flighting_ring: The flighting ring for feature update. + :type flighting_ring: str + :ivar is_enabled: Flag showing that whether the package is enabled. It doesn't schedule test + for package which is not enabled. + :vartype is_enabled: bool + :param blob_path: The file path of the package. + :type blob_path: str + :ivar validation_results: The validation results. There's validation on package when it's + created or updated. + :vartype validation_results: list[~restap_ifor_test_base.models.PackageValidationResult] + :param tests: The detailed test information. + :type tests: list[~restap_ifor_test_base.models.Test] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'test_types': {'readonly': True}, + 'package_status': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'is_enabled': {'readonly': True}, + 'validation_results': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'application_name': {'key': 'properties.applicationName', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'test_types': {'key': 'properties.testTypes', 'type': '[str]'}, + 'target_os_list': {'key': 'properties.targetOSList', 'type': '[TargetOSInfo]'}, + 'package_status': {'key': 'properties.packageStatus', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'flighting_ring': {'key': 'properties.flightingRing', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'blob_path': {'key': 'properties.blobPath', 'type': 'str'}, + 'validation_results': {'key': 'properties.validationResults', 'type': '[PackageValidationResult]'}, + 'tests': {'key': 'properties.tests', 'type': '[Test]'}, + } + + def __init__( + self, + **kwargs + ): + super(PackageResource, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.application_name = kwargs.get('application_name', None) + self.version = kwargs.get('version', None) + self.test_types = None + self.target_os_list = kwargs.get('target_os_list', None) + self.package_status = None + self.last_modified_time = None + self.flighting_ring = kwargs.get('flighting_ring', None) + self.is_enabled = None + self.blob_path = kwargs.get('blob_path', None) + self.validation_results = None + self.tests = kwargs.get('tests', None) + + +class PackageUpdateParameters(msrest.serialization.Model): + """Parameters supplied to update a Test Base Package. + + :param tags: A set of tags. The tags of the Package. + :type tags: dict[str, str] + :param target_os_list: Specifies the target OSs of specific OS Update types. + :type target_os_list: list[~restap_ifor_test_base.models.TargetOSInfo] + :param flighting_ring: The flighting ring for feature update. + :type flighting_ring: str + :param is_enabled: Specifies whether the package is enabled. It doesn't schedule test for + package which is not enabled. + :type is_enabled: bool + :param blob_path: The file name of the package. + :type blob_path: str + :param tests: The detailed test information. + :type tests: list[~restap_ifor_test_base.models.Test] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'target_os_list': {'key': 'properties.targetOSList', 'type': '[TargetOSInfo]'}, + 'flighting_ring': {'key': 'properties.flightingRing', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'blob_path': {'key': 'properties.blobPath', 'type': 'str'}, + 'tests': {'key': 'properties.tests', 'type': '[Test]'}, + } + + def __init__( + self, + **kwargs + ): + super(PackageUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.target_os_list = kwargs.get('target_os_list', None) + self.flighting_ring = kwargs.get('flighting_ring', None) + self.is_enabled = kwargs.get('is_enabled', None) + self.blob_path = kwargs.get('blob_path', None) + self.tests = kwargs.get('tests', None) + + +class PackageValidationResult(msrest.serialization.Model): + """The validation results. There's validation on package when it's created or updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar validation_name: Validation name. + :vartype validation_name: str + :ivar is_valid: Indicates whether the package passed the validation. + :vartype is_valid: bool + :ivar errors: Error information. + :vartype errors: list[str] + """ + + _validation = { + 'validation_name': {'readonly': True}, + 'is_valid': {'readonly': True}, + 'errors': {'readonly': True}, + } + + _attribute_map = { + 'validation_name': {'key': 'validationName', 'type': 'str'}, + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'errors': {'key': 'errors', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PackageValidationResult, self).__init__(**kwargs) + self.validation_name = None + self.is_valid = None + self.errors = None + + +class RegressionResult(msrest.serialization.Model): + """The regression result. + + :param file_name: FileName of the binary being analyzed. + :type file_name: str + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param details: Message that facilitates debugging a particular regression, if any was + inferred. + :type details: str + :param diff: Difference between the two datasets being analyzed. + :type diff: float + :param is_regressed: Indicates if a regression was inferred. + :type is_regressed: bool + """ + + _attribute_map = { + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'grade': {'key': 'grade', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + 'diff': {'key': 'diff', 'type': 'float'}, + 'is_regressed': {'key': 'isRegressed', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RegressionResult, self).__init__(**kwargs) + self.file_name = kwargs.get('file_name', None) + self.grade = kwargs.get('grade', None) + self.details = kwargs.get('details', None) + self.diff = kwargs.get('diff', None) + self.is_regressed = kwargs.get('is_regressed', None) + + +class RegressionTestDetails(msrest.serialization.Model): + """The details of a regression test. + + :param diff: Difference between the two datasets being analyzed. + :type diff: float + :param is_regressed: Indicates if a regression was inferred. + :type is_regressed: bool + """ + + _attribute_map = { + 'diff': {'key': 'diff', 'type': 'float'}, + 'is_regressed': {'key': 'isRegressed', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RegressionTestDetails, self).__init__(**kwargs) + self.diff = kwargs.get('diff', None) + self.is_regressed = kwargs.get('is_regressed', None) + + +class ReliabilityResult(msrest.serialization.Model): + """The Reliability Result. + + :param file_name: File name. + :type file_name: str + :param launch_count: Count of number of launches. + :type launch_count: int + :param crash_count: Count of number of crashes. + :type crash_count: int + :param hang_count: Count of number of hangs. + :type hang_count: int + :param regression_grade: The regression grade. Possible values include: "None", "NotAvailable", + "Pass", "Fail". + :type regression_grade: str or ~restap_ifor_test_base.models.Grade + :param crash_regression_grade: The statistic regression grade for crash signal. Possible values + include: "None", "NotAvailable", "Pass", "Fail". + :type crash_regression_grade: str or ~restap_ifor_test_base.models.Grade + :param crash_regression_test_details: Details related to the crash regression analysis. + :type crash_regression_test_details: ~restap_ifor_test_base.models.RegressionTestDetails + :param hang_regression_grade: The statistic regression grade for hang signal. Possible values + include: "None", "NotAvailable", "Pass", "Fail". + :type hang_regression_grade: str or ~restap_ifor_test_base.models.Grade + :param hang_regression_test_details: Details related to the hang regression analysis. + :type hang_regression_test_details: ~restap_ifor_test_base.models.RegressionTestDetails + """ + + _attribute_map = { + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'launch_count': {'key': 'launchCount', 'type': 'int'}, + 'crash_count': {'key': 'crashCount', 'type': 'int'}, + 'hang_count': {'key': 'hangCount', 'type': 'int'}, + 'regression_grade': {'key': 'regressionGrade', 'type': 'str'}, + 'crash_regression_grade': {'key': 'crashRegressionGrade', 'type': 'str'}, + 'crash_regression_test_details': {'key': 'crashRegressionTestDetails', 'type': 'RegressionTestDetails'}, + 'hang_regression_grade': {'key': 'hangRegressionGrade', 'type': 'str'}, + 'hang_regression_test_details': {'key': 'hangRegressionTestDetails', 'type': 'RegressionTestDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(ReliabilityResult, self).__init__(**kwargs) + self.file_name = kwargs.get('file_name', None) + self.launch_count = kwargs.get('launch_count', None) + self.crash_count = kwargs.get('crash_count', None) + self.hang_count = kwargs.get('hang_count', None) + self.regression_grade = kwargs.get('regression_grade', None) + self.crash_regression_grade = kwargs.get('crash_regression_grade', None) + self.crash_regression_test_details = kwargs.get('crash_regression_test_details', None) + self.hang_regression_grade = kwargs.get('hang_regression_grade', None) + self.hang_regression_test_details = kwargs.get('hang_regression_test_details', None) + + +class ReliabilityResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of Reliability Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param reliability_results: The result array data. + :type reliability_results: list[~restap_ifor_test_base.models.ReliabilityResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'reliability_results': {'key': 'reliabilityResults', 'type': '[ReliabilityResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReliabilityResultSingletonResourceProperties, self).__init__(**kwargs) + self.analysis_result_type = 'Reliability' # type: str + self.reliability_results = kwargs.get('reliability_results', None) + + +class ScriptExecutionResult(msrest.serialization.Model): + """The Script Execution Result. + + :param script_name: Name of script. + :type script_name: str + :param start_time: Start time of script execution. + :type start_time: ~datetime.datetime + :param end_time: End time of script execution. + :type end_time: ~datetime.datetime + :param exit_code: Exit code. + :type exit_code: int + :param time_out: Whether the subscription execution is timeout. + :type time_out: bool + """ + + _attribute_map = { + 'script_name': {'key': 'scriptName', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'exit_code': {'key': 'exitCode', 'type': 'int'}, + 'time_out': {'key': 'timeOut', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptExecutionResult, self).__init__(**kwargs) + self.script_name = kwargs.get('script_name', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.exit_code = kwargs.get('exit_code', None) + self.time_out = kwargs.get('time_out', None) + + +class ScriptExecutionResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of Script Execution Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param script_execution_results: The result array data. + :type script_execution_results: list[~restap_ifor_test_base.models.ScriptExecutionResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'script_execution_results': {'key': 'scriptExecutionResults', 'type': '[ScriptExecutionResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScriptExecutionResultSingletonResourceProperties, self).__init__(**kwargs) + self.analysis_result_type = 'ScriptExecution' # type: str + self.script_execution_results = kwargs.get('script_execution_results', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~restap_ifor_test_base.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 ~restap_ifor_test_base.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class TargetOSInfo(msrest.serialization.Model): + """The information of the target OS to be tested. + + All required parameters must be populated in order to send to Azure. + + :param os_update_type: Required. Specifies the OS update type to test against, e.g., 'Security + updates' or 'Feature updates'. + :type os_update_type: str + :param target_o_ss: Required. Specifies the target OSs to be tested. + :type target_o_ss: list[str] + """ + + _validation = { + 'os_update_type': {'required': True}, + 'target_o_ss': {'required': True}, + } + + _attribute_map = { + 'os_update_type': {'key': 'osUpdateType', 'type': 'str'}, + 'target_o_ss': {'key': 'targetOSs', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(TargetOSInfo, self).__init__(**kwargs) + self.os_update_type = kwargs['os_update_type'] + self.target_o_ss = kwargs['target_o_ss'] + + +class Test(msrest.serialization.Model): + """The definition of a Test. + + 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 test_type: Required. The type of the test. Possible values include: "OutOfBoxTest", + "FunctionalTest". + :type test_type: str or ~restap_ifor_test_base.models.TestType + :ivar validation_run_status: The status of the validation run of the package. Possible values + include: "Unknown", "Pending", "Passed", "Failed". + :vartype validation_run_status: str or ~restap_ifor_test_base.models.ValidationRunStatus + :param is_active: Indicates if this test is active.It doesn't schedule test for not active + Test. + :type is_active: bool + :param commands: Required. The commands used in the test. + :type commands: list[~restap_ifor_test_base.models.Command] + """ + + _validation = { + 'test_type': {'required': True}, + 'validation_run_status': {'readonly': True}, + 'commands': {'required': True}, + } + + _attribute_map = { + 'test_type': {'key': 'testType', 'type': 'str'}, + 'validation_run_status': {'key': 'validationRunStatus', 'type': 'str'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'commands': {'key': 'commands', 'type': '[Command]'}, + } + + def __init__( + self, + **kwargs + ): + super(Test, self).__init__(**kwargs) + self.test_type = kwargs['test_type'] + self.validation_run_status = None + self.is_active = kwargs.get('is_active', None) + self.commands = kwargs['commands'] + + +class TestBaseAccountListResult(msrest.serialization.Model): + """A list of Test Base Accounts. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Base Accounts. + :type value: list[~restap_ifor_test_base.models.TestBaseAccountResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestBaseAccountResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TestBaseAccountResource(TrackedResource): + """The Test Base Account resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", "Updating". + :vartype provisioning_state: str or ~restap_ifor_test_base.models.ProvisioningState + :param sku: The SKU of the Test Base Account. + :type sku: ~restap_ifor_test_base.models.TestBaseAccountSKU + :ivar access_level: The access level of the Test Base Account. + :vartype access_level: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'access_level': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'sku': {'key': 'properties.sku', 'type': 'TestBaseAccountSKU'}, + 'access_level': {'key': 'properties.accessLevel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountResource, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.sku = kwargs.get('sku', None) + self.access_level = None + + +class TestBaseAccountSKU(msrest.serialization.Model): + """Describes a Test Base Account SKU. + + 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 resource_type: The type of resource the SKU applies to. + :type resource_type: str + :param name: Required. The name of the SKU. This is typically a letter + number code, such as + B0 or S0. + :type name: str + :param tier: Required. The tier of this particular SKU. Possible values include: "Basic", + "Standard". + :type tier: str or ~restap_ifor_test_base.models.Tier + :ivar capabilities: The capabilities of a SKU. + :vartype capabilities: list[~restap_ifor_test_base.models.TestBaseAccountSKUCapability] + :param locations: The locations that the SKU is available. + :type locations: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'required': True}, + 'capabilities': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '[TestBaseAccountSKUCapability]'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountSKU, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.name = kwargs['name'] + self.tier = kwargs['tier'] + self.capabilities = None + self.locations = kwargs.get('locations', None) + + +class TestBaseAccountSKUCapability(msrest.serialization.Model): + """Properties of the Test Base Account SKU Capability. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. An invariant to describe the feature, such as 'SLA'. + :type name: str + :param value: Required. An invariant if the feature is measured by quantity, such as 99.9%. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountSKUCapability, self).__init__(**kwargs) + self.name = kwargs['name'] + self.value = kwargs['value'] + + +class TestBaseAccountSKUListResult(msrest.serialization.Model): + """A list of Test Base Account SKUs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Base Account SKUs. + :type value: list[~restap_ifor_test_base.models.TestBaseAccountSKU] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestBaseAccountSKU]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountSKUListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TestBaseAccountUpdateParameters(msrest.serialization.Model): + """Parameters supplied to update a Test Base Account. + + :param tags: A set of tags. The tags of the Test Base Account. + :type tags: dict[str, str] + :param sku: The SKU of the Test Base Account. + :type sku: ~restap_ifor_test_base.models.TestBaseAccountSKU + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'properties.sku', 'type': 'TestBaseAccountSKU'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + + +class TestBaseAccountUsageData(msrest.serialization.Model): + """The usage data of a Test Base Account. + + :param id: Fully qualified ARM resource id. + :type id: str + :param name: Localizable String object containing the name and a localized value. + :type name: ~restap_ifor_test_base.models.TestBaseAccountUsageName + :param unit: Representing the units of the usage quota. Possible values are: Count, Bytes, + Seconds, Percent, CountPerSecond, BytesPerSecond. + :type unit: str + :param limit: The maximum permitted value for the usage quota. If there is no limit, this value + will be -1. + :type limit: long + :param current_value: Current value for the usage quota. + :type current_value: long + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'TestBaseAccountUsageName'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountUsageData, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + self.limit = kwargs.get('limit', None) + self.current_value = kwargs.get('current_value', None) + + +class TestBaseAccountUsageDataList(msrest.serialization.Model): + """A list of Test Base Account usage data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Base Account usage data. + :type value: list[~restap_ifor_test_base.models.TestBaseAccountUsageData] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestBaseAccountUsageData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountUsageDataList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TestBaseAccountUsageName(msrest.serialization.Model): + """Localizable String object containing the name and a localized value. + + :param value: The identifier of the usage. + :type value: str + :param localized_value: Localized name of the usage. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestBaseAccountUsageName, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class TestResultAnalysisSummary(msrest.serialization.Model): + """The summary of a Test Analysis Result. + + :param name: Metric name. + :type name: str + :param analysis_status: The analysis status. Possible values include: "None", "Completed", + "InProgress", "Failed", "Succeeded", "Available", "NotAvailable". + :type analysis_status: str or ~restap_ifor_test_base.models.AnalysisStatus + :param grade: The grade of the test result. Possible values include: "None", "NotAvailable", + "Pass", "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'analysis_status': {'key': 'analysisStatus', 'type': 'str'}, + 'grade': {'key': 'grade', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestResultAnalysisSummary, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.analysis_status = kwargs.get('analysis_status', None) + self.grade = kwargs.get('grade', None) + + +class TestResultListResult(msrest.serialization.Model): + """A list of Test Results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Results. + :type value: list[~restap_ifor_test_base.models.TestResultResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestResultResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestResultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TestResultResource(ProxyResource): + """The Test Result Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param baseline_test_result_id: Azure Id of the baseline test result. + :type baseline_test_result_id: str + :param package_id: Resource Id of the package. + :type package_id: str + :param application_name: Application name. + :type application_name: str + :param application_version: Application version. + :type application_version: str + :param os_name: The operating system name, e.g. Windows 10 1809. + :type os_name: str + :param release_name: The name of the tested release (OS update). + :type release_name: str + :param release_version_date: The release version date of the tested release. + :type release_version_date: ~datetime.datetime + :param flighting_ring: The flighting ring, only for release of feature updates. + :type flighting_ring: str + :param build_version: The build version of the tested release (OS update). + :type build_version: str + :param build_revision: The build revision of the tested release (OS update). + :type build_revision: str + :param test_type: Test type. E.g. 'Out of box test' or 'Functional test'. + :type test_type: str + :param test_run_time: The run time of the test. + :type test_run_time: str + :param is_download_data_available: Whether download data is available. + :type is_download_data_available: bool + :param is_video_available: Whether video data is available. + :type is_video_available: bool + :param execution_status: The execution status of the test. Possible values include: "None", + "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", "Succeeded". + :type execution_status: str or ~restap_ifor_test_base.models.ExecutionStatus + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param kb_number: KB number. + :type kb_number: str + :param package_version: The version of the Windows update package. + :type package_version: str + :param analysis_summaries: List of analysis summaries. + :type analysis_summaries: list[~restap_ifor_test_base.models.TestResultAnalysisSummary] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'baseline_test_result_id': {'key': 'properties.baselineTestResultId', 'type': 'str'}, + 'package_id': {'key': 'properties.packageId', 'type': 'str'}, + 'application_name': {'key': 'properties.applicationName', 'type': 'str'}, + 'application_version': {'key': 'properties.applicationVersion', 'type': 'str'}, + 'os_name': {'key': 'properties.osName', 'type': 'str'}, + 'release_name': {'key': 'properties.releaseName', 'type': 'str'}, + 'release_version_date': {'key': 'properties.releaseVersionDate', 'type': 'iso-8601'}, + 'flighting_ring': {'key': 'properties.flightingRing', 'type': 'str'}, + 'build_version': {'key': 'properties.buildVersion', 'type': 'str'}, + 'build_revision': {'key': 'properties.buildRevision', 'type': 'str'}, + 'test_type': {'key': 'properties.testType', 'type': 'str'}, + 'test_run_time': {'key': 'properties.testRunTime', 'type': 'str'}, + 'is_download_data_available': {'key': 'properties.isDownloadDataAvailable', 'type': 'bool'}, + 'is_video_available': {'key': 'properties.isVideoAvailable', 'type': 'bool'}, + 'execution_status': {'key': 'properties.executionStatus', 'type': 'str'}, + 'grade': {'key': 'properties.grade', 'type': 'str'}, + 'kb_number': {'key': 'properties.kbNumber', 'type': 'str'}, + 'package_version': {'key': 'properties.packageVersion', 'type': 'str'}, + 'analysis_summaries': {'key': 'properties.analysisSummaries', 'type': '[TestResultAnalysisSummary]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestResultResource, self).__init__(**kwargs) + self.system_data = None + self.baseline_test_result_id = kwargs.get('baseline_test_result_id', None) + self.package_id = kwargs.get('package_id', None) + self.application_name = kwargs.get('application_name', None) + self.application_version = kwargs.get('application_version', None) + self.os_name = kwargs.get('os_name', None) + self.release_name = kwargs.get('release_name', None) + self.release_version_date = kwargs.get('release_version_date', None) + self.flighting_ring = kwargs.get('flighting_ring', None) + self.build_version = kwargs.get('build_version', None) + self.build_revision = kwargs.get('build_revision', None) + self.test_type = kwargs.get('test_type', None) + self.test_run_time = kwargs.get('test_run_time', None) + self.is_download_data_available = kwargs.get('is_download_data_available', None) + self.is_video_available = kwargs.get('is_video_available', None) + self.execution_status = kwargs.get('execution_status', None) + self.grade = kwargs.get('grade', None) + self.kb_number = kwargs.get('kb_number', None) + self.package_version = kwargs.get('package_version', None) + self.analysis_summaries = kwargs.get('analysis_summaries', None) + + +class TestSummaryListResult(msrest.serialization.Model): + """A list of Test Summaries. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Summaries. + :type value: list[~restap_ifor_test_base.models.TestSummaryResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestSummaryResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestSummaryListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TestSummaryResource(ProxyResource): + """Summary of a Test. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param test_summary_id: The Id of the current Test Summary. + :type test_summary_id: str + :param package_id: The Azure resource Id of package. + :type package_id: str + :param application_name: Application name. + :type application_name: str + :param application_version: Application version. + :type application_version: str + :param execution_status: The execution status of last test. Possible values include: "None", + "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", "Succeeded". + :type execution_status: str or ~restap_ifor_test_base.models.ExecutionStatus + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param test_run_time: The run time of the last test. + :type test_run_time: str + :param feature_updates_test_summary: The result summary of tests triggered by feature updates. + :type feature_updates_test_summary: ~restap_ifor_test_base.models.OSUpdatesTestSummary + :param security_updates_test_summary: The result summary of tests triggered by security + updates. + :type security_updates_test_summary: ~restap_ifor_test_base.models.OSUpdatesTestSummary + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'test_summary_id': {'key': 'properties.testSummaryId', 'type': 'str'}, + 'package_id': {'key': 'properties.packageId', 'type': 'str'}, + 'application_name': {'key': 'properties.applicationName', 'type': 'str'}, + 'application_version': {'key': 'properties.applicationVersion', 'type': 'str'}, + 'execution_status': {'key': 'properties.executionStatus', 'type': 'str'}, + 'grade': {'key': 'properties.grade', 'type': 'str'}, + 'test_run_time': {'key': 'properties.testRunTime', 'type': 'str'}, + 'feature_updates_test_summary': {'key': 'properties.featureUpdatesTestSummary', 'type': 'OSUpdatesTestSummary'}, + 'security_updates_test_summary': {'key': 'properties.securityUpdatesTestSummary', 'type': 'OSUpdatesTestSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(TestSummaryResource, self).__init__(**kwargs) + self.system_data = None + self.test_summary_id = kwargs.get('test_summary_id', None) + self.package_id = kwargs.get('package_id', None) + self.application_name = kwargs.get('application_name', None) + self.application_version = kwargs.get('application_version', None) + self.execution_status = kwargs.get('execution_status', None) + self.grade = kwargs.get('grade', None) + self.test_run_time = kwargs.get('test_run_time', None) + self.feature_updates_test_summary = kwargs.get('feature_updates_test_summary', None) + self.security_updates_test_summary = kwargs.get('security_updates_test_summary', None) + + +class TestTypeListResult(msrest.serialization.Model): + """A list of test types. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of test types. + :type value: list[~restap_ifor_test_base.models.TestTypeResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestTypeResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestTypeListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TestTypeResource(ProxyResource): + """The test type resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param actual_test_type_name: The actual name of a test type of a Test Base Account. + :type actual_test_type_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'actual_test_type_name': {'key': 'properties.actualTestTypeName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TestTypeResource, self).__init__(**kwargs) + self.system_data = None + self.actual_test_type_name = kwargs.get('actual_test_type_name', None) + + +class UtilizationBound(msrest.serialization.Model): + """The bound of a utilization result. + + :param percentile: The percentile of the bound. + :type percentile: float + :param value: The value of the bound. + :type value: float + """ + + _attribute_map = { + 'percentile': {'key': 'percentile', 'type': 'float'}, + 'value': {'key': 'value', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(UtilizationBound, self).__init__(**kwargs) + self.percentile = kwargs.get('percentile', None) + self.value = kwargs.get('value', None) + + +class UtilizationEntry(msrest.serialization.Model): + """The utilization entry. + + :param timestamp: The timestamp. + :type timestamp: ~datetime.datetime + :param value: The value. + :type value: float + """ + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'value': {'key': 'value', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(UtilizationEntry, self).__init__(**kwargs) + self.timestamp = kwargs.get('timestamp', None) + self.value = kwargs.get('value', None) + + +class UtilizationResult(msrest.serialization.Model): + """The Utilization Result. + + :param process: Process name, or '_total' for all processes. + :type process: str + :param upper_bound: Upper bound. + :type upper_bound: ~restap_ifor_test_base.models.UtilizationBound + :param lower_bound: Lower bound. + :type lower_bound: ~restap_ifor_test_base.models.UtilizationBound + :param utilization: Utilization data. + :type utilization: list[~restap_ifor_test_base.models.UtilizationEntry] + """ + + _attribute_map = { + 'process': {'key': 'process', 'type': 'str'}, + 'upper_bound': {'key': 'upperBound', 'type': 'UtilizationBound'}, + 'lower_bound': {'key': 'lowerBound', 'type': 'UtilizationBound'}, + 'utilization': {'key': 'utilization', 'type': '[UtilizationEntry]'}, + } + + def __init__( + self, + **kwargs + ): + super(UtilizationResult, self).__init__(**kwargs) + self.process = kwargs.get('process', None) + self.upper_bound = kwargs.get('upper_bound', None) + self.lower_bound = kwargs.get('lower_bound', None) + self.utilization = kwargs.get('utilization', None) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models_py3.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models_py3.py new file mode 100644 index 000000000000..c00df2603d4d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models_py3.py @@ -0,0 +1,2731 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._restap_ifor_test_base_enums import * + + +class AnalysisResultListResult(msrest.serialization.Model): + """A list of Analysis Results. It will only contain one element as all the data will be nested in a singleton object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Analysis Results. + :type value: list[~restap_ifor_test_base.models.AnalysisResultSingletonResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AnalysisResultSingletonResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AnalysisResultSingletonResource"]] = None, + **kwargs + ): + super(AnalysisResultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Resource(msrest.serialization.Model): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for an ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class AnalysisResultSingletonResource(ProxyResource): + """The Analysis Result Singleton Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Type of the Analysis Result.Constant filled by server. Possible + values include: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", + "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'grade': {'key': 'properties.grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'properties.analysisResultType', 'type': 'str'}, + } + + def __init__( + self, + *, + grade: Optional[Union[str, "Grade"]] = None, + **kwargs + ): + super(AnalysisResultSingletonResource, self).__init__(**kwargs) + self.system_data = None + self.grade = grade + self.analysis_result_type = None # type: Optional[str] + + +class AnalysisResultSingletonResourceProperties(msrest.serialization.Model): + """The properties of Analysis Result resource. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: CPURegressionResultSingletonResourceProperties, CPUUtilizationResultSingletonResourceProperties, MemoryRegressionResultSingletonResourceProperties, MemoryUtilizationResultSingletonResourceProperties, ReliabilityResultSingletonResourceProperties, ScriptExecutionResultSingletonResourceProperties. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + } + + _subtype_map = { + 'analysis_result_type': {'CPURegression': 'CPURegressionResultSingletonResourceProperties', 'CPUUtilization': 'CPUUtilizationResultSingletonResourceProperties', 'MemoryRegression': 'MemoryRegressionResultSingletonResourceProperties', 'MemoryUtilization': 'MemoryUtilizationResultSingletonResourceProperties', 'Reliability': 'ReliabilityResultSingletonResourceProperties', 'ScriptExecution': 'ScriptExecutionResultSingletonResourceProperties'} + } + + def __init__( + self, + *, + grade: Optional[Union[str, "Grade"]] = None, + **kwargs + ): + super(AnalysisResultSingletonResourceProperties, self).__init__(**kwargs) + self.grade = grade + self.analysis_result_type = None # type: Optional[str] + + +class AvailableOSListResult(msrest.serialization.Model): + """A list of available OSs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of available OSs. + :type value: list[~restap_ifor_test_base.models.AvailableOSResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AvailableOSResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AvailableOSResource"]] = None, + **kwargs + ): + super(AvailableOSListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AvailableOSResource(ProxyResource): + """The Available OS resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param os_id: The Id of an Available OS of a Test Base Account. + :type os_id: str + :param os_name: The name of an Available OS of a Test Base Account. + :type os_name: str + :param os_version: The version of an Available OS of a Test Base Account. + :type os_version: str + :param insider_channel: The insider channel of an Available OS of a Test Base Account. + :type insider_channel: str + :param os_update_type: The OS update type of an Available OS of a Test Base Account. + :type os_update_type: str + :param os_platform: The Platform of an Available OS of a Test Base Account. + :type os_platform: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'os_id': {'key': 'properties.osId', 'type': 'str'}, + 'os_name': {'key': 'properties.osName', 'type': 'str'}, + 'os_version': {'key': 'properties.osVersion', 'type': 'str'}, + 'insider_channel': {'key': 'properties.insiderChannel', 'type': 'str'}, + 'os_update_type': {'key': 'properties.osUpdateType', 'type': 'str'}, + 'os_platform': {'key': 'properties.osPlatform', 'type': 'str'}, + } + + def __init__( + self, + *, + os_id: Optional[str] = None, + os_name: Optional[str] = None, + os_version: Optional[str] = None, + insider_channel: Optional[str] = None, + os_update_type: Optional[str] = None, + os_platform: Optional[str] = None, + **kwargs + ): + super(AvailableOSResource, self).__init__(**kwargs) + self.system_data = None + self.os_id = os_id + self.os_name = os_name + self.os_version = os_version + self.insider_channel = insider_channel + self.os_update_type = os_update_type + self.os_platform = os_platform + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability response properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name_available: Value indicating the availability of the name: true if the name is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a name. Required if nameAvailable == false. + Possible values include: "Invalid", "AlreadyExists". + :type reason: str or ~restap_ifor_test_base.models.Reason + :ivar message: The detailed info regarding the reason associated with the name. Required if + nameAvailable == false. + :vartype message: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "Reason"]] = None, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = None + + +class Command(msrest.serialization.Model): + """The command used in the test. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the command. + :type name: str + :param action: Required. The action of the command. Possible values include: "Install", + "Launch", "Close", "Uninstall", "Custom". + :type action: str or ~restap_ifor_test_base.models.Action + :param content_type: Required. The type of command content. Possible values include: "Inline", + "File", "Path". + :type content_type: str or ~restap_ifor_test_base.models.ContentType + :param content: Required. The content of the command. The content depends on source type. + :type content: str + :param run_elevated: Specifies whether to run the command as administrator. + :type run_elevated: bool + :param restart_after: Specifies whether to restart the VM after the command executed. + :type restart_after: bool + :param max_run_time: Specifies the max run time of the command. + :type max_run_time: int + :param run_as_interactive: Specifies whether to run the command in interactive mode. + :type run_as_interactive: bool + :param always_run: Specifies whether to run the command even if a previous command is failed. + :type always_run: bool + :param apply_update_before: Specifies whether to apply update before the command. + :type apply_update_before: bool + """ + + _validation = { + 'name': {'required': True}, + 'action': {'required': True}, + 'content_type': {'required': True}, + 'content': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'content': {'key': 'content', 'type': 'str'}, + 'run_elevated': {'key': 'runElevated', 'type': 'bool'}, + 'restart_after': {'key': 'restartAfter', 'type': 'bool'}, + 'max_run_time': {'key': 'maxRunTime', 'type': 'int'}, + 'run_as_interactive': {'key': 'runAsInteractive', 'type': 'bool'}, + 'always_run': {'key': 'alwaysRun', 'type': 'bool'}, + 'apply_update_before': {'key': 'applyUpdateBefore', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + action: Union[str, "Action"], + content_type: Union[str, "ContentType"], + content: str, + run_elevated: Optional[bool] = None, + restart_after: Optional[bool] = None, + max_run_time: Optional[int] = None, + run_as_interactive: Optional[bool] = None, + always_run: Optional[bool] = None, + apply_update_before: Optional[bool] = None, + **kwargs + ): + super(Command, self).__init__(**kwargs) + self.name = name + self.action = action + self.content_type = content_type + self.content = content + self.run_elevated = run_elevated + self.restart_after = restart_after + self.max_run_time = max_run_time + self.run_as_interactive = run_as_interactive + self.always_run = always_run + self.apply_update_before = apply_update_before + + +class CPURegressionResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of CPU Regression Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param cpu_regression_results: The result array data. + :type cpu_regression_results: list[~restap_ifor_test_base.models.RegressionResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'cpu_regression_results': {'key': 'cpuRegressionResults', 'type': '[RegressionResult]'}, + } + + def __init__( + self, + *, + grade: Optional[Union[str, "Grade"]] = None, + cpu_regression_results: Optional[List["RegressionResult"]] = None, + **kwargs + ): + super(CPURegressionResultSingletonResourceProperties, self).__init__(grade=grade, **kwargs) + self.analysis_result_type = 'CPURegression' # type: str + self.cpu_regression_results = cpu_regression_results + + +class CPUUtilizationResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of CPU Utilization Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param cpu_utilization_results: The result array data. + :type cpu_utilization_results: list[~restap_ifor_test_base.models.UtilizationResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'cpu_utilization_results': {'key': 'cpuUtilizationResults', 'type': '[UtilizationResult]'}, + } + + def __init__( + self, + *, + grade: Optional[Union[str, "Grade"]] = None, + cpu_utilization_results: Optional[List["UtilizationResult"]] = None, + **kwargs + ): + super(CPUUtilizationResultSingletonResourceProperties, self).__init__(grade=grade, **kwargs) + self.analysis_result_type = 'CPUUtilization' # type: str + self.cpu_utilization_results = cpu_utilization_results + + +class DownloadURLResponse(msrest.serialization.Model): + """The response of getting a download URL. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar download_url: The download URL. + :vartype download_url: str + :ivar expiration_time: Expiry date of the download URL. + :vartype expiration_time: ~datetime.datetime + """ + + _validation = { + 'download_url': {'readonly': True}, + 'expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'download_url': {'key': 'downloadUrl', 'type': 'str'}, + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(DownloadURLResponse, self).__init__(**kwargs) + self.download_url = None + self.expiration_time = None + + +class ErrorDefinition(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~restap_ifor_test_base.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + + +class ErrorResponse(msrest.serialization.Model): + """The error response send when an operation fails. + + :param error: The error details. + :type error: ~restap_ifor_test_base.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class FavoriteProcessListResult(msrest.serialization.Model): + """A list of favorite processes for a package. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of favorite processes for a package. + :type value: list[~restap_ifor_test_base.models.FavoriteProcessResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FavoriteProcessResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["FavoriteProcessResource"]] = None, + **kwargs + ): + super(FavoriteProcessListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class FavoriteProcessResource(ProxyResource): + """A favorite process identifier. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param actual_process_name: The actual name of the favorite process. It will be equal to + resource name except for the scenario that the process name contains characters that are not + allowed in the resource name. + :type actual_process_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'actual_process_name': {'key': 'properties.actualProcessName', 'type': 'str'}, + } + + def __init__( + self, + *, + actual_process_name: Optional[str] = None, + **kwargs + ): + super(FavoriteProcessResource, self).__init__(**kwargs) + self.system_data = None + self.actual_process_name = actual_process_name + + +class FileUploadURLResponse(msrest.serialization.Model): + """The URL response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar upload_url: The URL used for uploading the package. + :vartype upload_url: str + :ivar blob_path: The blob path of the uploaded package. It will be used as the 'blobPath' + property of PackageResource. + :vartype blob_path: str + """ + + _validation = { + 'upload_url': {'readonly': True}, + 'blob_path': {'readonly': True}, + } + + _attribute_map = { + 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, + 'blob_path': {'key': 'blobPath', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FileUploadURLResponse, self).__init__(**kwargs) + self.upload_url = None + self.blob_path = None + + +class FlightingRingListResult(msrest.serialization.Model): + """A list of flighting rings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of flighting rings. + :type value: list[~restap_ifor_test_base.models.FlightingRingResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FlightingRingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["FlightingRingResource"]] = None, + **kwargs + ): + super(FlightingRingListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class FlightingRingResource(ProxyResource): + """The flighting ring resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param actual_flighting_ring_name: The actual name of a flighting ring of a Test Base Account. + :type actual_flighting_ring_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'actual_flighting_ring_name': {'key': 'properties.actualFlightingRingName', 'type': 'str'}, + } + + def __init__( + self, + *, + actual_flighting_ring_name: Optional[str] = None, + **kwargs + ): + super(FlightingRingResource, self).__init__(**kwargs) + self.system_data = None + self.actual_flighting_ring_name = actual_flighting_ring_name + + +class GetFileUploadURLParameters(msrest.serialization.Model): + """The parameters supplied to the Test Base Account GetFileUploadURL action. + + :param blob_name: The custom file name of the uploaded blob. + :type blob_name: str + """ + + _attribute_map = { + 'blob_name': {'key': 'blobName', 'type': 'str'}, + } + + def __init__( + self, + *, + blob_name: Optional[str] = None, + **kwargs + ): + super(GetFileUploadURLParameters, self).__init__(**kwargs) + self.blob_name = blob_name + + +class MemoryRegressionResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of Memory Regression Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param memory_regression_results: The result array data. + :type memory_regression_results: list[~restap_ifor_test_base.models.RegressionResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'memory_regression_results': {'key': 'memoryRegressionResults', 'type': '[RegressionResult]'}, + } + + def __init__( + self, + *, + grade: Optional[Union[str, "Grade"]] = None, + memory_regression_results: Optional[List["RegressionResult"]] = None, + **kwargs + ): + super(MemoryRegressionResultSingletonResourceProperties, self).__init__(grade=grade, **kwargs) + self.analysis_result_type = 'MemoryRegression' # type: str + self.memory_regression_results = memory_regression_results + + +class MemoryUtilizationResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of Memory Utilization Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param memory_utilization_results: The result array data. + :type memory_utilization_results: list[~restap_ifor_test_base.models.UtilizationResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'memory_utilization_results': {'key': 'memoryUtilizationResults', 'type': '[UtilizationResult]'}, + } + + def __init__( + self, + *, + grade: Optional[Union[str, "Grade"]] = None, + memory_utilization_results: Optional[List["UtilizationResult"]] = None, + **kwargs + ): + super(MemoryUtilizationResultSingletonResourceProperties, self).__init__(grade=grade, **kwargs) + self.analysis_result_type = 'MemoryUtilization' # type: str + self.memory_utilization_results = memory_utilization_results + + +class Operation(msrest.serialization.Model): + """REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar origin: Origin of the operation. + :vartype origin: str + :param display: The object that describes the operation. + :type display: ~restap_ifor_test_base.models.OperationDisplay + :param properties: Extra properties of the operation. + :type properties: str + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'properties': {'key': 'properties', 'type': 'str'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + properties: Optional[str] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.origin = None + self.display = display + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The resource provider name: Microsoft.TestBase. + :vartype provider: str + :ivar operation: Operation type: read, write, delete, listPackages, etc. + :vartype operation: str + :ivar resource: Resource type on which the operation is performed. + :vartype resource: str + :ivar description: Friendly name of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.operation = None + self.resource = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of operations supported by the resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of operations supported by the Test Base resource provider. + :type value: list[~restap_ifor_test_base.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class OSUpdateListResult(msrest.serialization.Model): + """A list of OS Updates. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of OS Updates. + :type value: list[~restap_ifor_test_base.models.OSUpdateResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OSUpdateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OSUpdateResource"]] = None, + **kwargs + ): + super(OSUpdateListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class OSUpdateResource(ProxyResource): + """An OS Update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param os_name: The name of the OS. + :type os_name: str + :param release: The name of tested release. + :type release: str + :param flighting_ring: The flighting ring, only for release of feature updates. + :type flighting_ring: str + :param build_version: The build version of the tested release (OS update). + :type build_version: str + :param build_revision: The build revision of the tested release (OS update). + :type build_revision: str + :param type_properties_type: The type of this release (OS update). Possible values include: + "SecurityUpdate", "FeatureUpdate". + :type type_properties_type: str or ~restap_ifor_test_base.models.Type + :param release_version_date: The release version date the tested release (OS update). + :type release_version_date: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'os_name': {'key': 'properties.osName', 'type': 'str'}, + 'release': {'key': 'properties.release', 'type': 'str'}, + 'flighting_ring': {'key': 'properties.flightingRing', 'type': 'str'}, + 'build_version': {'key': 'properties.buildVersion', 'type': 'str'}, + 'build_revision': {'key': 'properties.buildRevision', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'release_version_date': {'key': 'properties.releaseVersionDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + os_name: Optional[str] = None, + release: Optional[str] = None, + flighting_ring: Optional[str] = None, + build_version: Optional[str] = None, + build_revision: Optional[str] = None, + type_properties_type: Optional[Union[str, "Type"]] = None, + release_version_date: Optional[datetime.datetime] = None, + **kwargs + ): + super(OSUpdateResource, self).__init__(**kwargs) + self.system_data = None + self.os_name = os_name + self.release = release + self.flighting_ring = flighting_ring + self.build_version = build_version + self.build_revision = build_revision + self.type_properties_type = type_properties_type + self.release_version_date = release_version_date + + +class OSUpdatesTestSummary(msrest.serialization.Model): + """The summary of some tests. + + :param execution_status: The status of the last test. Possible values include: "None", + "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", "Succeeded". + :type execution_status: str or ~restap_ifor_test_base.models.ExecutionStatus + :param grade: The grade of last test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param test_run_time: The run time of the last test. + :type test_run_time: str + :param os_update_test_summaries: Detailed summary for each OS update. + :type os_update_test_summaries: list[~restap_ifor_test_base.models.OSUpdateTestSummary] + """ + + _attribute_map = { + 'execution_status': {'key': 'executionStatus', 'type': 'str'}, + 'grade': {'key': 'grade', 'type': 'str'}, + 'test_run_time': {'key': 'testRunTime', 'type': 'str'}, + 'os_update_test_summaries': {'key': 'osUpdateTestSummaries', 'type': '[OSUpdateTestSummary]'}, + } + + def __init__( + self, + *, + execution_status: Optional[Union[str, "ExecutionStatus"]] = None, + grade: Optional[Union[str, "Grade"]] = None, + test_run_time: Optional[str] = None, + os_update_test_summaries: Optional[List["OSUpdateTestSummary"]] = None, + **kwargs + ): + super(OSUpdatesTestSummary, self).__init__(**kwargs) + self.execution_status = execution_status + self.grade = grade + self.test_run_time = test_run_time + self.os_update_test_summaries = os_update_test_summaries + + +class OSUpdateTestSummary(msrest.serialization.Model): + """The summary of a test. + + :param os_name: The operating system name. e.g. Windows 10 1809. + :type os_name: str + :param release_name: The name of the tested release (OS update). + :type release_name: str + :param build_version: The build version of the tested release (OS update). + :type build_version: str + :param build_revision: The build revision of the tested release (OS update). + :type build_revision: str + :param release_version_date: The release version date. + :type release_version_date: ~datetime.datetime + :param flighting_ring: The flighting ring, only for release of feature updates. + :type flighting_ring: str + :param execution_status: The execution status of the test. Possible values include: "None", + "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", "Succeeded". + :type execution_status: str or ~restap_ifor_test_base.models.ExecutionStatus + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param test_run_time: The run time of the test. + :type test_run_time: str + :param test_type: The test type of the package. + :type test_type: str + """ + + _attribute_map = { + 'os_name': {'key': 'osName', 'type': 'str'}, + 'release_name': {'key': 'releaseName', 'type': 'str'}, + 'build_version': {'key': 'buildVersion', 'type': 'str'}, + 'build_revision': {'key': 'buildRevision', 'type': 'str'}, + 'release_version_date': {'key': 'releaseVersionDate', 'type': 'iso-8601'}, + 'flighting_ring': {'key': 'flightingRing', 'type': 'str'}, + 'execution_status': {'key': 'executionStatus', 'type': 'str'}, + 'grade': {'key': 'grade', 'type': 'str'}, + 'test_run_time': {'key': 'testRunTime', 'type': 'str'}, + 'test_type': {'key': 'testType', 'type': 'str'}, + } + + def __init__( + self, + *, + os_name: Optional[str] = None, + release_name: Optional[str] = None, + build_version: Optional[str] = None, + build_revision: Optional[str] = None, + release_version_date: Optional[datetime.datetime] = None, + flighting_ring: Optional[str] = None, + execution_status: Optional[Union[str, "ExecutionStatus"]] = None, + grade: Optional[Union[str, "Grade"]] = None, + test_run_time: Optional[str] = None, + test_type: Optional[str] = None, + **kwargs + ): + super(OSUpdateTestSummary, self).__init__(**kwargs) + self.os_name = os_name + self.release_name = release_name + self.build_version = build_version + self.build_revision = build_revision + self.release_version_date = release_version_date + self.flighting_ring = flighting_ring + self.execution_status = execution_status + self.grade = grade + self.test_run_time = test_run_time + self.test_type = test_type + + +class PackageCheckNameAvailabilityParameters(msrest.serialization.Model): + """Parameters body to pass for Test Base Package name availability check. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name to verify. + :type name: str + :param application_name: Required. Application name to verify. + :type application_name: str + :param version: Required. Version name to verify. + :type version: str + :param type: Required. fully qualified resource type which includes provider namespace. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'application_name': {'required': True}, + 'version': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'application_name': {'key': 'applicationName', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + application_name: str, + version: str, + type: str, + **kwargs + ): + super(PackageCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + self.application_name = application_name + self.version = version + self.type = type + + +class PackageListResult(msrest.serialization.Model): + """A list of Test Base Packages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Base Packages. + :type value: list[~restap_ifor_test_base.models.PackageResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PackageResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PackageResource"]] = None, + **kwargs + ): + super(PackageListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TrackedResource(Resource): + """The resource model definition for an ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + self.etag = None + + +class PackageResource(TrackedResource): + """The Test Base Package resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", "Updating". + :vartype provisioning_state: str or ~restap_ifor_test_base.models.ProvisioningState + :param application_name: Application name. + :type application_name: str + :param version: Application version. + :type version: str + :ivar test_types: OOB, functional or both. Mapped to the data in 'tests' property. + :vartype test_types: list[str or ~restap_ifor_test_base.models.TestType] + :param target_os_list: Specifies the target OSs of specific OS Update types. + :type target_os_list: list[~restap_ifor_test_base.models.TargetOSInfo] + :ivar package_status: The status of the package. Possible values include: "Unknown", + "Registered", "Ready", "Error", "ValidatingPackage", "PreValidationCheckPass", "Deleted", + "ValidationLongerThanUsual", "VerifyingPackage". + :vartype package_status: str or ~restap_ifor_test_base.models.PackageStatus + :ivar last_modified_time: The UTC timestamp when the package was last modified. + :vartype last_modified_time: ~datetime.datetime + :param flighting_ring: The flighting ring for feature update. + :type flighting_ring: str + :ivar is_enabled: Flag showing that whether the package is enabled. It doesn't schedule test + for package which is not enabled. + :vartype is_enabled: bool + :param blob_path: The file path of the package. + :type blob_path: str + :ivar validation_results: The validation results. There's validation on package when it's + created or updated. + :vartype validation_results: list[~restap_ifor_test_base.models.PackageValidationResult] + :param tests: The detailed test information. + :type tests: list[~restap_ifor_test_base.models.Test] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'test_types': {'readonly': True}, + 'package_status': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'is_enabled': {'readonly': True}, + 'validation_results': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'application_name': {'key': 'properties.applicationName', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'test_types': {'key': 'properties.testTypes', 'type': '[str]'}, + 'target_os_list': {'key': 'properties.targetOSList', 'type': '[TargetOSInfo]'}, + 'package_status': {'key': 'properties.packageStatus', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'flighting_ring': {'key': 'properties.flightingRing', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'blob_path': {'key': 'properties.blobPath', 'type': 'str'}, + 'validation_results': {'key': 'properties.validationResults', 'type': '[PackageValidationResult]'}, + 'tests': {'key': 'properties.tests', 'type': '[Test]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + application_name: Optional[str] = None, + version: Optional[str] = None, + target_os_list: Optional[List["TargetOSInfo"]] = None, + flighting_ring: Optional[str] = None, + blob_path: Optional[str] = None, + tests: Optional[List["Test"]] = None, + **kwargs + ): + super(PackageResource, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.provisioning_state = None + self.application_name = application_name + self.version = version + self.test_types = None + self.target_os_list = target_os_list + self.package_status = None + self.last_modified_time = None + self.flighting_ring = flighting_ring + self.is_enabled = None + self.blob_path = blob_path + self.validation_results = None + self.tests = tests + + +class PackageUpdateParameters(msrest.serialization.Model): + """Parameters supplied to update a Test Base Package. + + :param tags: A set of tags. The tags of the Package. + :type tags: dict[str, str] + :param target_os_list: Specifies the target OSs of specific OS Update types. + :type target_os_list: list[~restap_ifor_test_base.models.TargetOSInfo] + :param flighting_ring: The flighting ring for feature update. + :type flighting_ring: str + :param is_enabled: Specifies whether the package is enabled. It doesn't schedule test for + package which is not enabled. + :type is_enabled: bool + :param blob_path: The file name of the package. + :type blob_path: str + :param tests: The detailed test information. + :type tests: list[~restap_ifor_test_base.models.Test] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'target_os_list': {'key': 'properties.targetOSList', 'type': '[TargetOSInfo]'}, + 'flighting_ring': {'key': 'properties.flightingRing', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'blob_path': {'key': 'properties.blobPath', 'type': 'str'}, + 'tests': {'key': 'properties.tests', 'type': '[Test]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + target_os_list: Optional[List["TargetOSInfo"]] = None, + flighting_ring: Optional[str] = None, + is_enabled: Optional[bool] = None, + blob_path: Optional[str] = None, + tests: Optional[List["Test"]] = None, + **kwargs + ): + super(PackageUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.target_os_list = target_os_list + self.flighting_ring = flighting_ring + self.is_enabled = is_enabled + self.blob_path = blob_path + self.tests = tests + + +class PackageValidationResult(msrest.serialization.Model): + """The validation results. There's validation on package when it's created or updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar validation_name: Validation name. + :vartype validation_name: str + :ivar is_valid: Indicates whether the package passed the validation. + :vartype is_valid: bool + :ivar errors: Error information. + :vartype errors: list[str] + """ + + _validation = { + 'validation_name': {'readonly': True}, + 'is_valid': {'readonly': True}, + 'errors': {'readonly': True}, + } + + _attribute_map = { + 'validation_name': {'key': 'validationName', 'type': 'str'}, + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'errors': {'key': 'errors', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PackageValidationResult, self).__init__(**kwargs) + self.validation_name = None + self.is_valid = None + self.errors = None + + +class RegressionResult(msrest.serialization.Model): + """The regression result. + + :param file_name: FileName of the binary being analyzed. + :type file_name: str + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param details: Message that facilitates debugging a particular regression, if any was + inferred. + :type details: str + :param diff: Difference between the two datasets being analyzed. + :type diff: float + :param is_regressed: Indicates if a regression was inferred. + :type is_regressed: bool + """ + + _attribute_map = { + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'grade': {'key': 'grade', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + 'diff': {'key': 'diff', 'type': 'float'}, + 'is_regressed': {'key': 'isRegressed', 'type': 'bool'}, + } + + def __init__( + self, + *, + file_name: Optional[str] = None, + grade: Optional[Union[str, "Grade"]] = None, + details: Optional[str] = None, + diff: Optional[float] = None, + is_regressed: Optional[bool] = None, + **kwargs + ): + super(RegressionResult, self).__init__(**kwargs) + self.file_name = file_name + self.grade = grade + self.details = details + self.diff = diff + self.is_regressed = is_regressed + + +class RegressionTestDetails(msrest.serialization.Model): + """The details of a regression test. + + :param diff: Difference between the two datasets being analyzed. + :type diff: float + :param is_regressed: Indicates if a regression was inferred. + :type is_regressed: bool + """ + + _attribute_map = { + 'diff': {'key': 'diff', 'type': 'float'}, + 'is_regressed': {'key': 'isRegressed', 'type': 'bool'}, + } + + def __init__( + self, + *, + diff: Optional[float] = None, + is_regressed: Optional[bool] = None, + **kwargs + ): + super(RegressionTestDetails, self).__init__(**kwargs) + self.diff = diff + self.is_regressed = is_regressed + + +class ReliabilityResult(msrest.serialization.Model): + """The Reliability Result. + + :param file_name: File name. + :type file_name: str + :param launch_count: Count of number of launches. + :type launch_count: int + :param crash_count: Count of number of crashes. + :type crash_count: int + :param hang_count: Count of number of hangs. + :type hang_count: int + :param regression_grade: The regression grade. Possible values include: "None", "NotAvailable", + "Pass", "Fail". + :type regression_grade: str or ~restap_ifor_test_base.models.Grade + :param crash_regression_grade: The statistic regression grade for crash signal. Possible values + include: "None", "NotAvailable", "Pass", "Fail". + :type crash_regression_grade: str or ~restap_ifor_test_base.models.Grade + :param crash_regression_test_details: Details related to the crash regression analysis. + :type crash_regression_test_details: ~restap_ifor_test_base.models.RegressionTestDetails + :param hang_regression_grade: The statistic regression grade for hang signal. Possible values + include: "None", "NotAvailable", "Pass", "Fail". + :type hang_regression_grade: str or ~restap_ifor_test_base.models.Grade + :param hang_regression_test_details: Details related to the hang regression analysis. + :type hang_regression_test_details: ~restap_ifor_test_base.models.RegressionTestDetails + """ + + _attribute_map = { + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'launch_count': {'key': 'launchCount', 'type': 'int'}, + 'crash_count': {'key': 'crashCount', 'type': 'int'}, + 'hang_count': {'key': 'hangCount', 'type': 'int'}, + 'regression_grade': {'key': 'regressionGrade', 'type': 'str'}, + 'crash_regression_grade': {'key': 'crashRegressionGrade', 'type': 'str'}, + 'crash_regression_test_details': {'key': 'crashRegressionTestDetails', 'type': 'RegressionTestDetails'}, + 'hang_regression_grade': {'key': 'hangRegressionGrade', 'type': 'str'}, + 'hang_regression_test_details': {'key': 'hangRegressionTestDetails', 'type': 'RegressionTestDetails'}, + } + + def __init__( + self, + *, + file_name: Optional[str] = None, + launch_count: Optional[int] = None, + crash_count: Optional[int] = None, + hang_count: Optional[int] = None, + regression_grade: Optional[Union[str, "Grade"]] = None, + crash_regression_grade: Optional[Union[str, "Grade"]] = None, + crash_regression_test_details: Optional["RegressionTestDetails"] = None, + hang_regression_grade: Optional[Union[str, "Grade"]] = None, + hang_regression_test_details: Optional["RegressionTestDetails"] = None, + **kwargs + ): + super(ReliabilityResult, self).__init__(**kwargs) + self.file_name = file_name + self.launch_count = launch_count + self.crash_count = crash_count + self.hang_count = hang_count + self.regression_grade = regression_grade + self.crash_regression_grade = crash_regression_grade + self.crash_regression_test_details = crash_regression_test_details + self.hang_regression_grade = hang_regression_grade + self.hang_regression_test_details = hang_regression_test_details + + +class ReliabilityResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of Reliability Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param reliability_results: The result array data. + :type reliability_results: list[~restap_ifor_test_base.models.ReliabilityResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'reliability_results': {'key': 'reliabilityResults', 'type': '[ReliabilityResult]'}, + } + + def __init__( + self, + *, + grade: Optional[Union[str, "Grade"]] = None, + reliability_results: Optional[List["ReliabilityResult"]] = None, + **kwargs + ): + super(ReliabilityResultSingletonResourceProperties, self).__init__(grade=grade, **kwargs) + self.analysis_result_type = 'Reliability' # type: str + self.reliability_results = reliability_results + + +class ScriptExecutionResult(msrest.serialization.Model): + """The Script Execution Result. + + :param script_name: Name of script. + :type script_name: str + :param start_time: Start time of script execution. + :type start_time: ~datetime.datetime + :param end_time: End time of script execution. + :type end_time: ~datetime.datetime + :param exit_code: Exit code. + :type exit_code: int + :param time_out: Whether the subscription execution is timeout. + :type time_out: bool + """ + + _attribute_map = { + 'script_name': {'key': 'scriptName', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'exit_code': {'key': 'exitCode', 'type': 'int'}, + 'time_out': {'key': 'timeOut', 'type': 'bool'}, + } + + def __init__( + self, + *, + script_name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + exit_code: Optional[int] = None, + time_out: Optional[bool] = None, + **kwargs + ): + super(ScriptExecutionResult, self).__init__(**kwargs) + self.script_name = script_name + self.start_time = start_time + self.end_time = end_time + self.exit_code = exit_code + self.time_out = time_out + + +class ScriptExecutionResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): + """The properties of Script Execution Result. + + All required parameters must be populated in order to send to Azure. + + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param analysis_result_type: Required. Type of the Analysis Result.Constant filled by server. + Possible values include: "ScriptExecution", "Reliability", "CPUUtilization", + "MemoryUtilization", "CPURegression", "MemoryRegression". + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :param script_execution_results: The result array data. + :type script_execution_results: list[~restap_ifor_test_base.models.ScriptExecutionResult] + """ + + _validation = { + 'analysis_result_type': {'required': True}, + } + + _attribute_map = { + 'grade': {'key': 'grade', 'type': 'str'}, + 'analysis_result_type': {'key': 'analysisResultType', 'type': 'str'}, + 'script_execution_results': {'key': 'scriptExecutionResults', 'type': '[ScriptExecutionResult]'}, + } + + def __init__( + self, + *, + grade: Optional[Union[str, "Grade"]] = None, + script_execution_results: Optional[List["ScriptExecutionResult"]] = None, + **kwargs + ): + super(ScriptExecutionResultSingletonResourceProperties, self).__init__(grade=grade, **kwargs) + self.analysis_result_type = 'ScriptExecution' # type: str + self.script_execution_results = script_execution_results + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~restap_ifor_test_base.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 ~restap_ifor_test_base.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TargetOSInfo(msrest.serialization.Model): + """The information of the target OS to be tested. + + All required parameters must be populated in order to send to Azure. + + :param os_update_type: Required. Specifies the OS update type to test against, e.g., 'Security + updates' or 'Feature updates'. + :type os_update_type: str + :param target_o_ss: Required. Specifies the target OSs to be tested. + :type target_o_ss: list[str] + """ + + _validation = { + 'os_update_type': {'required': True}, + 'target_o_ss': {'required': True}, + } + + _attribute_map = { + 'os_update_type': {'key': 'osUpdateType', 'type': 'str'}, + 'target_o_ss': {'key': 'targetOSs', 'type': '[str]'}, + } + + def __init__( + self, + *, + os_update_type: str, + target_o_ss: List[str], + **kwargs + ): + super(TargetOSInfo, self).__init__(**kwargs) + self.os_update_type = os_update_type + self.target_o_ss = target_o_ss + + +class Test(msrest.serialization.Model): + """The definition of a Test. + + 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 test_type: Required. The type of the test. Possible values include: "OutOfBoxTest", + "FunctionalTest". + :type test_type: str or ~restap_ifor_test_base.models.TestType + :ivar validation_run_status: The status of the validation run of the package. Possible values + include: "Unknown", "Pending", "Passed", "Failed". + :vartype validation_run_status: str or ~restap_ifor_test_base.models.ValidationRunStatus + :param is_active: Indicates if this test is active.It doesn't schedule test for not active + Test. + :type is_active: bool + :param commands: Required. The commands used in the test. + :type commands: list[~restap_ifor_test_base.models.Command] + """ + + _validation = { + 'test_type': {'required': True}, + 'validation_run_status': {'readonly': True}, + 'commands': {'required': True}, + } + + _attribute_map = { + 'test_type': {'key': 'testType', 'type': 'str'}, + 'validation_run_status': {'key': 'validationRunStatus', 'type': 'str'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'commands': {'key': 'commands', 'type': '[Command]'}, + } + + def __init__( + self, + *, + test_type: Union[str, "TestType"], + commands: List["Command"], + is_active: Optional[bool] = None, + **kwargs + ): + super(Test, self).__init__(**kwargs) + self.test_type = test_type + self.validation_run_status = None + self.is_active = is_active + self.commands = commands + + +class TestBaseAccountListResult(msrest.serialization.Model): + """A list of Test Base Accounts. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Base Accounts. + :type value: list[~restap_ifor_test_base.models.TestBaseAccountResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestBaseAccountResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TestBaseAccountResource"]] = None, + **kwargs + ): + super(TestBaseAccountListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TestBaseAccountResource(TrackedResource): + """The Test Base Account resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. The tags of the resource. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Possible values include: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", "Updating". + :vartype provisioning_state: str or ~restap_ifor_test_base.models.ProvisioningState + :param sku: The SKU of the Test Base Account. + :type sku: ~restap_ifor_test_base.models.TestBaseAccountSKU + :ivar access_level: The access level of the Test Base Account. + :vartype access_level: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'access_level': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'sku': {'key': 'properties.sku', 'type': 'TestBaseAccountSKU'}, + 'access_level': {'key': 'properties.accessLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["TestBaseAccountSKU"] = None, + **kwargs + ): + super(TestBaseAccountResource, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.provisioning_state = None + self.sku = sku + self.access_level = None + + +class TestBaseAccountSKU(msrest.serialization.Model): + """Describes a Test Base Account SKU. + + 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 resource_type: The type of resource the SKU applies to. + :type resource_type: str + :param name: Required. The name of the SKU. This is typically a letter + number code, such as + B0 or S0. + :type name: str + :param tier: Required. The tier of this particular SKU. Possible values include: "Basic", + "Standard". + :type tier: str or ~restap_ifor_test_base.models.Tier + :ivar capabilities: The capabilities of a SKU. + :vartype capabilities: list[~restap_ifor_test_base.models.TestBaseAccountSKUCapability] + :param locations: The locations that the SKU is available. + :type locations: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'required': True}, + 'capabilities': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '[TestBaseAccountSKUCapability]'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: str, + tier: Union[str, "Tier"], + resource_type: Optional[str] = None, + locations: Optional[List[str]] = None, + **kwargs + ): + super(TestBaseAccountSKU, self).__init__(**kwargs) + self.resource_type = resource_type + self.name = name + self.tier = tier + self.capabilities = None + self.locations = locations + + +class TestBaseAccountSKUCapability(msrest.serialization.Model): + """Properties of the Test Base Account SKU Capability. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. An invariant to describe the feature, such as 'SLA'. + :type name: str + :param value: Required. An invariant if the feature is measured by quantity, such as 99.9%. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + value: str, + **kwargs + ): + super(TestBaseAccountSKUCapability, self).__init__(**kwargs) + self.name = name + self.value = value + + +class TestBaseAccountSKUListResult(msrest.serialization.Model): + """A list of Test Base Account SKUs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Base Account SKUs. + :type value: list[~restap_ifor_test_base.models.TestBaseAccountSKU] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestBaseAccountSKU]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TestBaseAccountSKU"]] = None, + **kwargs + ): + super(TestBaseAccountSKUListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TestBaseAccountUpdateParameters(msrest.serialization.Model): + """Parameters supplied to update a Test Base Account. + + :param tags: A set of tags. The tags of the Test Base Account. + :type tags: dict[str, str] + :param sku: The SKU of the Test Base Account. + :type sku: ~restap_ifor_test_base.models.TestBaseAccountSKU + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'properties.sku', 'type': 'TestBaseAccountSKU'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["TestBaseAccountSKU"] = None, + **kwargs + ): + super(TestBaseAccountUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + + +class TestBaseAccountUsageData(msrest.serialization.Model): + """The usage data of a Test Base Account. + + :param id: Fully qualified ARM resource id. + :type id: str + :param name: Localizable String object containing the name and a localized value. + :type name: ~restap_ifor_test_base.models.TestBaseAccountUsageName + :param unit: Representing the units of the usage quota. Possible values are: Count, Bytes, + Seconds, Percent, CountPerSecond, BytesPerSecond. + :type unit: str + :param limit: The maximum permitted value for the usage quota. If there is no limit, this value + will be -1. + :type limit: long + :param current_value: Current value for the usage quota. + :type current_value: long + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'TestBaseAccountUsageName'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional["TestBaseAccountUsageName"] = None, + unit: Optional[str] = None, + limit: Optional[int] = None, + current_value: Optional[int] = None, + **kwargs + ): + super(TestBaseAccountUsageData, self).__init__(**kwargs) + self.id = id + self.name = name + self.unit = unit + self.limit = limit + self.current_value = current_value + + +class TestBaseAccountUsageDataList(msrest.serialization.Model): + """A list of Test Base Account usage data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Base Account usage data. + :type value: list[~restap_ifor_test_base.models.TestBaseAccountUsageData] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestBaseAccountUsageData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TestBaseAccountUsageData"]] = None, + **kwargs + ): + super(TestBaseAccountUsageDataList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TestBaseAccountUsageName(msrest.serialization.Model): + """Localizable String object containing the name and a localized value. + + :param value: The identifier of the usage. + :type value: str + :param localized_value: Localized name of the usage. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): + super(TestBaseAccountUsageName, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class TestResultAnalysisSummary(msrest.serialization.Model): + """The summary of a Test Analysis Result. + + :param name: Metric name. + :type name: str + :param analysis_status: The analysis status. Possible values include: "None", "Completed", + "InProgress", "Failed", "Succeeded", "Available", "NotAvailable". + :type analysis_status: str or ~restap_ifor_test_base.models.AnalysisStatus + :param grade: The grade of the test result. Possible values include: "None", "NotAvailable", + "Pass", "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'analysis_status': {'key': 'analysisStatus', 'type': 'str'}, + 'grade': {'key': 'grade', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + analysis_status: Optional[Union[str, "AnalysisStatus"]] = None, + grade: Optional[Union[str, "Grade"]] = None, + **kwargs + ): + super(TestResultAnalysisSummary, self).__init__(**kwargs) + self.name = name + self.analysis_status = analysis_status + self.grade = grade + + +class TestResultListResult(msrest.serialization.Model): + """A list of Test Results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Results. + :type value: list[~restap_ifor_test_base.models.TestResultResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestResultResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TestResultResource"]] = None, + **kwargs + ): + super(TestResultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TestResultResource(ProxyResource): + """The Test Result Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param baseline_test_result_id: Azure Id of the baseline test result. + :type baseline_test_result_id: str + :param package_id: Resource Id of the package. + :type package_id: str + :param application_name: Application name. + :type application_name: str + :param application_version: Application version. + :type application_version: str + :param os_name: The operating system name, e.g. Windows 10 1809. + :type os_name: str + :param release_name: The name of the tested release (OS update). + :type release_name: str + :param release_version_date: The release version date of the tested release. + :type release_version_date: ~datetime.datetime + :param flighting_ring: The flighting ring, only for release of feature updates. + :type flighting_ring: str + :param build_version: The build version of the tested release (OS update). + :type build_version: str + :param build_revision: The build revision of the tested release (OS update). + :type build_revision: str + :param test_type: Test type. E.g. 'Out of box test' or 'Functional test'. + :type test_type: str + :param test_run_time: The run time of the test. + :type test_run_time: str + :param is_download_data_available: Whether download data is available. + :type is_download_data_available: bool + :param is_video_available: Whether video data is available. + :type is_video_available: bool + :param execution_status: The execution status of the test. Possible values include: "None", + "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", "Succeeded". + :type execution_status: str or ~restap_ifor_test_base.models.ExecutionStatus + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param kb_number: KB number. + :type kb_number: str + :param package_version: The version of the Windows update package. + :type package_version: str + :param analysis_summaries: List of analysis summaries. + :type analysis_summaries: list[~restap_ifor_test_base.models.TestResultAnalysisSummary] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'baseline_test_result_id': {'key': 'properties.baselineTestResultId', 'type': 'str'}, + 'package_id': {'key': 'properties.packageId', 'type': 'str'}, + 'application_name': {'key': 'properties.applicationName', 'type': 'str'}, + 'application_version': {'key': 'properties.applicationVersion', 'type': 'str'}, + 'os_name': {'key': 'properties.osName', 'type': 'str'}, + 'release_name': {'key': 'properties.releaseName', 'type': 'str'}, + 'release_version_date': {'key': 'properties.releaseVersionDate', 'type': 'iso-8601'}, + 'flighting_ring': {'key': 'properties.flightingRing', 'type': 'str'}, + 'build_version': {'key': 'properties.buildVersion', 'type': 'str'}, + 'build_revision': {'key': 'properties.buildRevision', 'type': 'str'}, + 'test_type': {'key': 'properties.testType', 'type': 'str'}, + 'test_run_time': {'key': 'properties.testRunTime', 'type': 'str'}, + 'is_download_data_available': {'key': 'properties.isDownloadDataAvailable', 'type': 'bool'}, + 'is_video_available': {'key': 'properties.isVideoAvailable', 'type': 'bool'}, + 'execution_status': {'key': 'properties.executionStatus', 'type': 'str'}, + 'grade': {'key': 'properties.grade', 'type': 'str'}, + 'kb_number': {'key': 'properties.kbNumber', 'type': 'str'}, + 'package_version': {'key': 'properties.packageVersion', 'type': 'str'}, + 'analysis_summaries': {'key': 'properties.analysisSummaries', 'type': '[TestResultAnalysisSummary]'}, + } + + def __init__( + self, + *, + baseline_test_result_id: Optional[str] = None, + package_id: Optional[str] = None, + application_name: Optional[str] = None, + application_version: Optional[str] = None, + os_name: Optional[str] = None, + release_name: Optional[str] = None, + release_version_date: Optional[datetime.datetime] = None, + flighting_ring: Optional[str] = None, + build_version: Optional[str] = None, + build_revision: Optional[str] = None, + test_type: Optional[str] = None, + test_run_time: Optional[str] = None, + is_download_data_available: Optional[bool] = None, + is_video_available: Optional[bool] = None, + execution_status: Optional[Union[str, "ExecutionStatus"]] = None, + grade: Optional[Union[str, "Grade"]] = None, + kb_number: Optional[str] = None, + package_version: Optional[str] = None, + analysis_summaries: Optional[List["TestResultAnalysisSummary"]] = None, + **kwargs + ): + super(TestResultResource, self).__init__(**kwargs) + self.system_data = None + self.baseline_test_result_id = baseline_test_result_id + self.package_id = package_id + self.application_name = application_name + self.application_version = application_version + self.os_name = os_name + self.release_name = release_name + self.release_version_date = release_version_date + self.flighting_ring = flighting_ring + self.build_version = build_version + self.build_revision = build_revision + self.test_type = test_type + self.test_run_time = test_run_time + self.is_download_data_available = is_download_data_available + self.is_video_available = is_video_available + self.execution_status = execution_status + self.grade = grade + self.kb_number = kb_number + self.package_version = package_version + self.analysis_summaries = analysis_summaries + + +class TestSummaryListResult(msrest.serialization.Model): + """A list of Test Summaries. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of Test Summaries. + :type value: list[~restap_ifor_test_base.models.TestSummaryResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestSummaryResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TestSummaryResource"]] = None, + **kwargs + ): + super(TestSummaryListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TestSummaryResource(ProxyResource): + """Summary of a Test. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param test_summary_id: The Id of the current Test Summary. + :type test_summary_id: str + :param package_id: The Azure resource Id of package. + :type package_id: str + :param application_name: Application name. + :type application_name: str + :param application_version: Application version. + :type application_version: str + :param execution_status: The execution status of last test. Possible values include: "None", + "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", "Succeeded". + :type execution_status: str or ~restap_ifor_test_base.models.ExecutionStatus + :param grade: The grade of the test. Possible values include: "None", "NotAvailable", "Pass", + "Fail". + :type grade: str or ~restap_ifor_test_base.models.Grade + :param test_run_time: The run time of the last test. + :type test_run_time: str + :param feature_updates_test_summary: The result summary of tests triggered by feature updates. + :type feature_updates_test_summary: ~restap_ifor_test_base.models.OSUpdatesTestSummary + :param security_updates_test_summary: The result summary of tests triggered by security + updates. + :type security_updates_test_summary: ~restap_ifor_test_base.models.OSUpdatesTestSummary + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'test_summary_id': {'key': 'properties.testSummaryId', 'type': 'str'}, + 'package_id': {'key': 'properties.packageId', 'type': 'str'}, + 'application_name': {'key': 'properties.applicationName', 'type': 'str'}, + 'application_version': {'key': 'properties.applicationVersion', 'type': 'str'}, + 'execution_status': {'key': 'properties.executionStatus', 'type': 'str'}, + 'grade': {'key': 'properties.grade', 'type': 'str'}, + 'test_run_time': {'key': 'properties.testRunTime', 'type': 'str'}, + 'feature_updates_test_summary': {'key': 'properties.featureUpdatesTestSummary', 'type': 'OSUpdatesTestSummary'}, + 'security_updates_test_summary': {'key': 'properties.securityUpdatesTestSummary', 'type': 'OSUpdatesTestSummary'}, + } + + def __init__( + self, + *, + test_summary_id: Optional[str] = None, + package_id: Optional[str] = None, + application_name: Optional[str] = None, + application_version: Optional[str] = None, + execution_status: Optional[Union[str, "ExecutionStatus"]] = None, + grade: Optional[Union[str, "Grade"]] = None, + test_run_time: Optional[str] = None, + feature_updates_test_summary: Optional["OSUpdatesTestSummary"] = None, + security_updates_test_summary: Optional["OSUpdatesTestSummary"] = None, + **kwargs + ): + super(TestSummaryResource, self).__init__(**kwargs) + self.system_data = None + self.test_summary_id = test_summary_id + self.package_id = package_id + self.application_name = application_name + self.application_version = application_version + self.execution_status = execution_status + self.grade = grade + self.test_run_time = test_run_time + self.feature_updates_test_summary = feature_updates_test_summary + self.security_updates_test_summary = security_updates_test_summary + + +class TestTypeListResult(msrest.serialization.Model): + """A list of test types. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of test types. + :type value: list[~restap_ifor_test_base.models.TestTypeResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TestTypeResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TestTypeResource"]] = None, + **kwargs + ): + super(TestTypeListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TestTypeResource(ProxyResource): + """The test type resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~restap_ifor_test_base.models.SystemData + :param actual_test_type_name: The actual name of a test type of a Test Base Account. + :type actual_test_type_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'actual_test_type_name': {'key': 'properties.actualTestTypeName', 'type': 'str'}, + } + + def __init__( + self, + *, + actual_test_type_name: Optional[str] = None, + **kwargs + ): + super(TestTypeResource, self).__init__(**kwargs) + self.system_data = None + self.actual_test_type_name = actual_test_type_name + + +class UtilizationBound(msrest.serialization.Model): + """The bound of a utilization result. + + :param percentile: The percentile of the bound. + :type percentile: float + :param value: The value of the bound. + :type value: float + """ + + _attribute_map = { + 'percentile': {'key': 'percentile', 'type': 'float'}, + 'value': {'key': 'value', 'type': 'float'}, + } + + def __init__( + self, + *, + percentile: Optional[float] = None, + value: Optional[float] = None, + **kwargs + ): + super(UtilizationBound, self).__init__(**kwargs) + self.percentile = percentile + self.value = value + + +class UtilizationEntry(msrest.serialization.Model): + """The utilization entry. + + :param timestamp: The timestamp. + :type timestamp: ~datetime.datetime + :param value: The value. + :type value: float + """ + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'value': {'key': 'value', 'type': 'float'}, + } + + def __init__( + self, + *, + timestamp: Optional[datetime.datetime] = None, + value: Optional[float] = None, + **kwargs + ): + super(UtilizationEntry, self).__init__(**kwargs) + self.timestamp = timestamp + self.value = value + + +class UtilizationResult(msrest.serialization.Model): + """The Utilization Result. + + :param process: Process name, or '_total' for all processes. + :type process: str + :param upper_bound: Upper bound. + :type upper_bound: ~restap_ifor_test_base.models.UtilizationBound + :param lower_bound: Lower bound. + :type lower_bound: ~restap_ifor_test_base.models.UtilizationBound + :param utilization: Utilization data. + :type utilization: list[~restap_ifor_test_base.models.UtilizationEntry] + """ + + _attribute_map = { + 'process': {'key': 'process', 'type': 'str'}, + 'upper_bound': {'key': 'upperBound', 'type': 'UtilizationBound'}, + 'lower_bound': {'key': 'lowerBound', 'type': 'UtilizationBound'}, + 'utilization': {'key': 'utilization', 'type': '[UtilizationEntry]'}, + } + + def __init__( + self, + *, + process: Optional[str] = None, + upper_bound: Optional["UtilizationBound"] = None, + lower_bound: Optional["UtilizationBound"] = None, + utilization: Optional[List["UtilizationEntry"]] = None, + **kwargs + ): + super(UtilizationResult, self).__init__(**kwargs) + self.process = process + self.upper_bound = upper_bound + self.lower_bound = lower_bound + self.utilization = utilization diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_restap_ifor_test_base_enums.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_restap_ifor_test_base_enums.py new file mode 100644 index 000000000000..b3932e438ada --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_restap_ifor_test_base_enums.py @@ -0,0 +1,176 @@ +# 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 Action(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The action of the command. + """ + + INSTALL = "Install" + LAUNCH = "Launch" + CLOSE = "Close" + UNINSTALL = "Uninstall" + CUSTOM = "Custom" + +class AnalysisResultName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + SCRIPT_EXECUTION = "scriptExecution" + RELIABILITY = "reliability" + MEMORY_UTILIZATION = "memoryUtilization" + CPU_UTILIZATION = "cpuUtilization" + MEMORY_REGRESSION = "memoryRegression" + CPU_REGRESSION = "cpuRegression" + +class AnalysisResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Analysis Result. + """ + + SCRIPT_EXECUTION = "ScriptExecution" + RELIABILITY = "Reliability" + CPU_UTILIZATION = "CPUUtilization" + MEMORY_UTILIZATION = "MemoryUtilization" + CPU_REGRESSION = "CPURegression" + MEMORY_REGRESSION = "MemoryRegression" + +class AnalysisStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The analysis status. + """ + + NONE = "None" + COMPLETED = "Completed" + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + AVAILABLE = "Available" + NOT_AVAILABLE = "NotAvailable" + +class ContentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of command content. + """ + + INLINE = "Inline" + FILE = "File" + PATH = "Path" + +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 ExecutionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The execution status of a test. + """ + + NONE = "None" + IN_PROGRESS = "InProgress" + PROCESSING = "Processing" + COMPLETED = "Completed" + NOT_EXECUTED = "NotExecuted" + INCOMPLETE = "Incomplete" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + +class Grade(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The grade of a test. + """ + + NONE = "None" + NOT_AVAILABLE = "NotAvailable" + PASS_ENUM = "Pass" + FAIL = "Fail" + +class OsUpdateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + SECURITY_UPDATE = "SecurityUpdate" + FEATURE_UPDATE = "FeatureUpdate" + +class PackageStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the package. + """ + + UNKNOWN = "Unknown" + REGISTERED = "Registered" + READY = "Ready" + ERROR = "Error" + VALIDATING_PACKAGE = "ValidatingPackage" + PRE_VALIDATION_CHECK_PASS = "PreValidationCheckPass" + DELETED = "Deleted" + VALIDATION_LONGER_THAN_USUAL = "ValidationLongerThanUsual" + VERIFYING_PACKAGE = "VerifyingPackage" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """ARM provisioning state, see + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELLED = "Cancelled" + CREATING = "Creating" + DELETING = "Deleting" + UPDATING = "Updating" + +class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reason for unavailability of a name. Required if nameAvailable == false. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class TestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The test type. + """ + + OUT_OF_BOX_TEST = "OutOfBoxTest" + FUNCTIONAL_TEST = "FunctionalTest" + +class Tier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The tier of this particular SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + +class Type(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of this release (OS update). + """ + + SECURITY_UPDATE = "SecurityUpdate" + FEATURE_UPDATE = "FeatureUpdate" + +class ValidationRunStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the validation run of the package. + """ + + UNKNOWN = "Unknown" + PENDING = "Pending" + PASSED = "Passed" + FAILED = "Failed" diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/__init__.py new file mode 100644 index 000000000000..e051cdc25c0b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/__init__.py @@ -0,0 +1,59 @@ +# 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 ._skus_operations import SKUsOperations +from ._test_base_accounts_operations import TestBaseAccountsOperations +from ._test_base_account_operations import TestBaseAccountOperations +from ._test_base_account_usage_operations import TestBaseAccountUsageOperations +from ._restap_ifor_test_base_operations import RESTAPIForTestBaseOperationsMixin +from ._test_base_account_available_oss_operations import TestBaseAccountAvailableOSsOperations +from ._test_base_account_available_os_operations import TestBaseAccountAvailableOSOperations +from ._test_base_account_flighting_rings_operations import TestBaseAccountFlightingRingsOperations +from ._test_base_account_flighting_ring_operations import TestBaseAccountFlightingRingOperations +from ._test_base_account_test_types_operations import TestBaseAccountTestTypesOperations +from ._test_base_account_test_type_operations import TestBaseAccountTestTypeOperations +from ._packages_operations import PackagesOperations +from ._package_operations import PackageOperations +from ._test_summaries_operations import TestSummariesOperations +from ._test_summary_operations import TestSummaryOperations +from ._test_results_operations import TestResultsOperations +from ._test_result_operations import TestResultOperations +from ._os_updates_operations import OSUpdatesOperations +from ._os_update_operations import OSUpdateOperations +from ._favorite_processes_operations import FavoriteProcessesOperations +from ._favorite_process_operations import FavoriteProcessOperations +from ._analysis_results_operations import AnalysisResultsOperations +from ._analysis_result_operations import AnalysisResultOperations +from ._operations import Operations + +__all__ = [ + 'SKUsOperations', + 'TestBaseAccountsOperations', + 'TestBaseAccountOperations', + 'TestBaseAccountUsageOperations', + 'RESTAPIForTestBaseOperationsMixin', + 'TestBaseAccountAvailableOSsOperations', + 'TestBaseAccountAvailableOSOperations', + 'TestBaseAccountFlightingRingsOperations', + 'TestBaseAccountFlightingRingOperations', + 'TestBaseAccountTestTypesOperations', + 'TestBaseAccountTestTypeOperations', + 'PackagesOperations', + 'PackageOperations', + 'TestSummariesOperations', + 'TestSummaryOperations', + 'TestResultsOperations', + 'TestResultOperations', + 'OSUpdatesOperations', + 'OSUpdateOperations', + 'FavoriteProcessesOperations', + 'FavoriteProcessOperations', + 'AnalysisResultsOperations', + 'AnalysisResultOperations', + 'Operations', +] diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_result_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_result_operations.py new file mode 100644 index 000000000000..70ff00d878a0 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_result_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AnalysisResultOperations(object): + """AnalysisResultOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + test_result_name, # type: str + analysis_result_name, # type: Union[str, "_models.AnalysisResultName"] + **kwargs # type: Any + ): + # type: (...) -> "_models.AnalysisResultSingletonResource" + """Gets an Analysis Result of a Test Result by name. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :param analysis_result_name: The name of the Analysis Result of a Test Result. + :type analysis_result_name: str or ~restap_ifor_test_base.models.AnalysisResultName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResultSingletonResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.AnalysisResultSingletonResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalysisResultSingletonResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_name, 'str'), + 'analysisResultName': self._serialize.url("analysis_result_name", analysis_result_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AnalysisResultSingletonResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults/{analysisResultName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_results_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_results_operations.py new file mode 100644 index 000000000000..399d30db09ae --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_results_operations.py @@ -0,0 +1,135 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AnalysisResultsOperations(object): + """AnalysisResultsOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + package_name, # type: str + test_result_name, # type: str + analysis_result_type, # type: Union[str, "_models.AnalysisResultType"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AnalysisResultListResult"] + """Lists the Analysis Results of a Test Result. The result collection will only contain one + element as all the data will be nested in a singleton object. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :param analysis_result_type: The type of the Analysis Result of a Test Result. + :type analysis_result_type: str or ~restap_ifor_test_base.models.AnalysisResultType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AnalysisResultListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.AnalysisResultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalysisResultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['analysisResultType'] = self._serialize.query("analysis_result_type", analysis_result_type, '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('AnalysisResultListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_process_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_process_operations.py new file mode 100644 index 000000000000..5adf83236451 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_process_operations.py @@ -0,0 +1,260 @@ +# 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 FavoriteProcessOperations(object): + """FavoriteProcessOperations 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: ~restap_ifor_test_base.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 create( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + favorite_process_resource_name, # type: str + parameters, # type: "_models.FavoriteProcessResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.FavoriteProcessResource" + """Create or replace a favorite process for a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param favorite_process_resource_name: The resource name of a favorite process in a package. If + the process name contains characters that are not allowed in Azure Resource Name, we use + 'actualProcessName' in request body to submit the name. + :type favorite_process_resource_name: str + :param parameters: Parameters supplied to create a favorite process in a package. + :type parameters: ~restap_ifor_test_base.models.FavoriteProcessResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FavoriteProcessResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.FavoriteProcessResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FavoriteProcessResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'favoriteProcessResourceName': self._serialize.url("favorite_process_resource_name", favorite_process_resource_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(parameters, 'FavoriteProcessResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FavoriteProcessResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + favorite_process_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a favorite process for a specific package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param favorite_process_resource_name: The resource name of a favorite process in a package. If + the process name contains characters that are not allowed in Azure Resource Name, we use + 'actualProcessName' in request body to submit the name. + :type favorite_process_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'favoriteProcessResourceName': self._serialize.url("favorite_process_resource_name", favorite_process_resource_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) + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + favorite_process_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.FavoriteProcessResource" + """Gets a favorite process for a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param favorite_process_resource_name: The resource name of a favorite process in a package. If + the process name contains characters that are not allowed in Azure Resource Name, we use + 'actualProcessName' in request body to submit the name. + :type favorite_process_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FavoriteProcessResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.FavoriteProcessResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FavoriteProcessResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'favoriteProcessResourceName': self._serialize.url("favorite_process_resource_name", favorite_process_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FavoriteProcessResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_processes_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_processes_operations.py new file mode 100644 index 000000000000..21ef2cee4947 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_processes_operations.py @@ -0,0 +1,126 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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 FavoriteProcessesOperations(object): + """FavoriteProcessesOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + package_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.FavoriteProcessListResult"] + """Lists the favorite processes for a specific package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FavoriteProcessListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.FavoriteProcessListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FavoriteProcessListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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') + + 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('FavoriteProcessListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_operations.py new file mode 100644 index 000000000000..2e5c618c793e --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~restap_ifor_test_base.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.OperationListResult"] + """Lists all of the available REST API operations of the Microsoft.TestBase provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('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.TestBase/operations'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_update_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_update_operations.py new file mode 100644 index 000000000000..9982bbcb341f --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_update_operations.py @@ -0,0 +1,113 @@ +# 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 OSUpdateOperations(object): + """OSUpdateOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + os_update_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.OSUpdateResource" + """Gets an OS Update by name in which the package was tested before. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param os_update_resource_name: The resource name of an OS Update. + :type os_update_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSUpdateResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.OSUpdateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OSUpdateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'osUpdateResourceName': self._serialize.url("os_update_resource_name", os_update_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OSUpdateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates/{osUpdateResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_updates_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_updates_operations.py new file mode 100644 index 000000000000..3391515822e7 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_updates_operations.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OSUpdatesOperations(object): + """OSUpdatesOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + package_name, # type: str + os_update_type, # type: Union[str, "_models.OsUpdateType"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OSUpdateListResult"] + """Lists the OS Updates in which the package were tested before. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param os_update_type: The type of the OS Update. + :type os_update_type: str or ~restap_ifor_test_base.models.OsUpdateType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OSUpdateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.OSUpdateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OSUpdateListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['osUpdateType'] = self._serialize.query("os_update_type", os_update_type, '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('OSUpdateListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_package_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_package_operations.py new file mode 100644 index 000000000000..bb3bb2a05e90 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_package_operations.py @@ -0,0 +1,642 @@ +# 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 PackageOperations(object): + """PackageOperations 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: ~restap_ifor_test_base.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 _create_initial( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + parameters, # type: "_models.PackageResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.PackageResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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(parameters, 'PackageResource') + 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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('PackageResource', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PackageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + parameters, # type: "_models.PackageResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PackageResource"] + """Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param parameters: Parameters supplied to create a Test Base Package. + :type parameters: ~restap_ifor_test_base.models.PackageResource + :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 PackageResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~restap_ifor_test_base.models.PackageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageResource"] + 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_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + package_name=package_name, + parameters=parameters, + 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('PackageResource', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + parameters, # type: "_models.PackageUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PackageResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PackageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + 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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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(parameters, 'PackageUpdateParameters') + 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, 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) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PackageResource', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + parameters, # type: "_models.PackageUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PackageResource"] + """Update an existing Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param parameters: Parameters supplied to update a Test Base Package. + :type parameters: ~restap_ifor_test_base.models.PackageUpdateParameters + :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 PackageResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~restap_ifor_test_base.models.PackageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageResource"] + 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, + test_base_account_name=test_base_account_name, + package_name=package_name, + parameters=parameters, + 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('PackageResource', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_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-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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, 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) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_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, + test_base_account_name=test_base_account_name, + package_name=package_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PackageResource" + """Gets a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PackageResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.PackageResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PackageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}'} # type: ignore + + def _hard_delete_initial( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_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-05-10-preview" + accept = "application/json" + + # Construct URL + url = self._hard_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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, 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) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _hard_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete'} # type: ignore + + def begin_hard_delete( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Hard Delete a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_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._hard_delete_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + package_name=package_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_hard_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_packages_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_packages_operations.py new file mode 100644 index 000000000000..e0dc64fdc57b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_packages_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 PackagesOperations(object): + """PackagesOperations 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: ~restap_ifor_test_base.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_test_base_account( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PackageListResult"] + """Lists all the packages under a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PackageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.PackageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PackageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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_test_base_account.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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') + + 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('PackageListResult', 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_test_base_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_restap_ifor_test_base_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_restap_ifor_test_base_operations.py new file mode 100644 index 000000000000..b4296238f465 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_restap_ifor_test_base_operations.py @@ -0,0 +1,365 @@ +# 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 RESTAPIForTestBaseOperationsMixin(object): + + def test_base_account_get_file_upload_url( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + parameters=None, # type: Optional["_models.GetFileUploadURLParameters"] + **kwargs # type: Any + ): + # type: (...) -> "_models.FileUploadURLResponse" + """Gets the file upload URL of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param parameters: Parameters supplied to the Test Base Account GetFileUploadURL operation. + :type parameters: ~restap_ifor_test_base.models.GetFileUploadURLParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FileUploadURLResponse, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.FileUploadURLResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileUploadURLResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_base_account_get_file_upload_url.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'GetFileUploadURLParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FileUploadURLResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_base_account_get_file_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFileUploadUrl'} # type: ignore + + def check_package_name_availability( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + parameters, # type: "_models.PackageCheckNameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Checks that the Test Base Package name and version is valid and is not already in use. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param parameters: Parameters supplied to the Test Base Package CheckNameAvailability + operation. + :type parameters: ~restap_ifor_test_base.models.PackageCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_package_name_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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['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(parameters, 'PackageCheckNameAvailabilityParameters') + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_package_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkPackageNameAvailability'} # type: ignore + + def package_get_download_url( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DownloadURLResponse" + """Gets the download URL of a package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DownloadURLResponse, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.DownloadURLResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DownloadURLResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self.package_get_download_url.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DownloadURLResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + package_get_download_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/getDownloadUrl'} # type: ignore + + def test_result_get_download_url( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + test_result_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DownloadURLResponse" + """Gets the download URL or the test result. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DownloadURLResponse, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.DownloadURLResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DownloadURLResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self.test_result_get_download_url.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DownloadURLResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_result_get_download_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getDownloadUrl'} # type: ignore + + def test_result_get_video_download_url( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + test_result_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DownloadURLResponse" + """Gets the download URL of the test execution screen recording. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DownloadURLResponse, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.DownloadURLResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DownloadURLResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + # Construct URL + url = self.test_result_get_video_download_url.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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DownloadURLResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_result_get_video_download_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getVideoDownloadUrl'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_skus_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_skus_operations.py new file mode 100644 index 000000000000..73ebd1f865f5 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_skus_operations.py @@ -0,0 +1,114 @@ +# 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 SKUsOperations(object): + """SKUsOperations 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: ~restap_ifor_test_base.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.TestBaseAccountSKUListResult"] + """Lists the available SKUs of Test Base Account in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestBaseAccountSKUListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.TestBaseAccountSKUListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountSKUListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TestBaseAccountSKUListResult', 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': '/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/skus'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_available_os_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_available_os_operations.py new file mode 100644 index 000000000000..6967dd50815b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_available_os_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.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 TestBaseAccountAvailableOSOperations(object): + """TestBaseAccountAvailableOSOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + available_os_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableOSResource" + """Gets an available OS to run a package under a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param available_os_resource_name: The resource name of an Available OS. + :type available_os_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableOSResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.AvailableOSResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOSResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'availableOSResourceName': self._serialize.url("available_os_resource_name", available_os_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableOSResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs/{availableOSResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_available_oss_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_available_oss_operations.py new file mode 100644 index 000000000000..18936ed42ed4 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_available_oss_operations.py @@ -0,0 +1,126 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TestBaseAccountAvailableOSsOperations(object): + """TestBaseAccountAvailableOSsOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + os_update_type, # type: Union[str, "_models.OsUpdateType"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOSListResult"] + """Lists all the available OSs to run a package under a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param os_update_type: The type of the OS Update. + :type os_update_type: str or ~restap_ifor_test_base.models.OsUpdateType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOSListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.AvailableOSListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOSListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['osUpdateType'] = self._serialize.query("os_update_type", os_update_type, '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('AvailableOSListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_flighting_ring_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_flighting_ring_operations.py new file mode 100644 index 000000000000..1d3f842e1103 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_flighting_ring_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.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 TestBaseAccountFlightingRingOperations(object): + """TestBaseAccountFlightingRingOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + flighting_ring_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.FlightingRingResource" + """Gets a flighting ring of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param flighting_ring_resource_name: The resource name of a flighting ring. + :type flighting_ring_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FlightingRingResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.FlightingRingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FlightingRingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'flightingRingResourceName': self._serialize.url("flighting_ring_resource_name", flighting_ring_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FlightingRingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings/{flightingRingResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_flighting_rings_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_flighting_rings_operations.py new file mode 100644 index 000000000000..f95101b6eb95 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_flighting_rings_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 TestBaseAccountFlightingRingsOperations(object): + """TestBaseAccountFlightingRingsOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.FlightingRingListResult"] + """Lists all the flighting rings of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FlightingRingListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.FlightingRingListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FlightingRingListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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') + + 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('FlightingRingListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_operations.py new file mode 100644 index 000000000000..dd40fef51f6d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_operations.py @@ -0,0 +1,619 @@ +# 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 TestBaseAccountOperations(object): + """TestBaseAccountOperations 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: ~restap_ifor_test_base.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 _create_initial( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + parameters, # type: "_models.TestBaseAccountResource" + restore=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.TestBaseAccountResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if restore is not None: + query_parameters['restore'] = self._serialize.query("restore", restore, 'bool') + 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(parameters, 'TestBaseAccountResource') + 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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('TestBaseAccountResource', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('TestBaseAccountResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + parameters, # type: "_models.TestBaseAccountResource" + restore=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.TestBaseAccountResource"] + """Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the + specified subscription. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param parameters: Parameters supplied to create a Test Base Account. + :type parameters: ~restap_ifor_test_base.models.TestBaseAccountResource + :param restore: The flag indicating if we would like to restore the Test Base Accounts which + were soft deleted before. + :type restore: bool + :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 TestBaseAccountResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~restap_ifor_test_base.models.TestBaseAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountResource"] + 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_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + parameters=parameters, + restore=restore, + 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('TestBaseAccountResource', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + parameters, # type: "_models.TestBaseAccountUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.TestBaseAccountResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.TestBaseAccountResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + 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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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['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(parameters, 'TestBaseAccountUpdateParameters') + 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, 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) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TestBaseAccountResource', pipeline_response) + + if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + parameters, # type: "_models.TestBaseAccountUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.TestBaseAccountResource"] + """Update an existing Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param parameters: Parameters supplied to update a Test Base Account. + :type parameters: ~restap_ifor_test_base.models.TestBaseAccountUpdateParameters + :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 TestBaseAccountResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~restap_ifor_test_base.models.TestBaseAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountResource"] + 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, + test_base_account_name=test_base_account_name, + parameters=parameters, + 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('TestBaseAccountResource', 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + test_base_account_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-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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.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) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_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, + test_base_account_name=test_base_account_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestBaseAccountResource" + """Gets a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestBaseAccountResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.TestBaseAccountResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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.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('TestBaseAccountResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}'} # type: ignore + + def _offboard_initial( + self, + resource_group_name, # type: str + test_base_account_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-05-10-preview" + accept = "application/json" + + # Construct URL + url = self._offboard_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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 + + 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) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _offboard_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard'} # type: ignore + + def begin_offboard( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Offboard a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_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._offboard_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_offboard.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_test_type_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_test_type_operations.py new file mode 100644 index 000000000000..1b4bc3d9fb6d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_test_type_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.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 TestBaseAccountTestTypeOperations(object): + """TestBaseAccountTestTypeOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + test_type_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestTypeResource" + """Gets a test type of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param test_type_resource_name: The resource name of a test type. + :type test_type_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestTypeResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.TestTypeResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestTypeResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'testTypeResourceName': self._serialize.url("test_type_resource_name", test_type_resource_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestTypeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes/{testTypeResourceName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_test_types_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_test_types_operations.py new file mode 100644 index 000000000000..57e1e1533377 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_test_types_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 TestBaseAccountTestTypesOperations(object): + """TestBaseAccountTestTypesOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TestTypeListResult"] + """Lists all the test types of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestTypeListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.TestTypeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestTypeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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') + + 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('TestTypeListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_usage_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_usage_operations.py new file mode 100644 index 000000000000..9b44b0097c47 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_account_usage_operations.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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 TestBaseAccountUsageOperations(object): + """TestBaseAccountUsageOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TestBaseAccountUsageDataList"] + """Lists the usage data of a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param filter: Odata filter. + :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 TestBaseAccountUsageDataList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.TestBaseAccountUsageDataList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountUsageDataList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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('TestBaseAccountUsageDataList', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/usages'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_accounts_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_accounts_operations.py new file mode 100644 index 000000000000..872d5483d7d1 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_accounts_operations.py @@ -0,0 +1,198 @@ +# 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 TestBaseAccountsOperations(object): + """TestBaseAccountsOperations 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: ~restap_ifor_test_base.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_subscription( + self, + get_deleted=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TestBaseAccountListResult"] + """Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + + :param get_deleted: The flag indicating if we need to include the Test Base Accounts which were + soft deleted before. + :type get_deleted: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestBaseAccountListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.TestBaseAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if get_deleted is not None: + query_parameters['getDeleted'] = self._serialize.query("get_deleted", get_deleted, 'bool') + 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('TestBaseAccountListResult', 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.TestBase/testBaseAccounts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + get_deleted=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TestBaseAccountListResult"] + """Lists all the Test Base Accounts in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param get_deleted: The flag indicating if we need to include the Test Base Accounts which were + soft deleted before. + :type get_deleted: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestBaseAccountListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.TestBaseAccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestBaseAccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if get_deleted is not None: + query_parameters['getDeleted'] = self._serialize.query("get_deleted", get_deleted, 'bool') + 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('TestBaseAccountListResult', 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_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_result_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_result_operations.py new file mode 100644 index 000000000000..2b9db15507ee --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_result_operations.py @@ -0,0 +1,113 @@ +# 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 TestResultOperations(object): + """TestResultOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + package_name, # type: str + test_result_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestResultResource" + """Get the Test Result by Id with specified OS Update type for a Test Base Package. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param test_result_name: The Test Result Name. It equals to {osName}-{TestResultId} string. + :type test_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestResultResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.TestResultResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestResultResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + 'testResultName': self._serialize.url("test_result_name", test_result_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestResultResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_results_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_results_operations.py new file mode 100644 index 000000000000..240dc163ad00 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_results_operations.py @@ -0,0 +1,136 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TestResultsOperations(object): + """TestResultsOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + package_name, # type: str + os_update_type, # type: Union[str, "_models.OsUpdateType"] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TestResultListResult"] + """Lists all the Test Results with specified OS Update type for a Test Base Package. Can be + filtered by osName, releaseName, flightingRing, buildVersion, buildRevision. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param package_name: The resource name of the Test Base Package. + :type package_name: str + :param os_update_type: The type of the OS Update. + :type os_update_type: str or ~restap_ifor_test_base.models.OsUpdateType + :param filter: Odata filter. + :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 TestResultListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.TestResultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestResultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'packageName': self._serialize.url("package_name", package_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['osUpdateType'] = self._serialize.query("os_update_type", os_update_type, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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('TestResultListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summaries_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summaries_operations.py new file mode 100644 index 000000000000..b75fc683274a --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summaries_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import 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 TestSummariesOperations(object): + """TestSummariesOperations 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: ~restap_ifor_test_base.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 + test_base_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TestSummaryListResult"] + """Lists the Test Summaries of all the packages under a Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TestSummaryListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~restap_ifor_test_base.models.TestSummaryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestSummaryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_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') + + 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('TestSummaryListResult', 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summary_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summary_operations.py new file mode 100644 index 000000000000..a9836ca0fdf5 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summary_operations.py @@ -0,0 +1,110 @@ +# 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 TestSummaryOperations(object): + """TestSummaryOperations 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: ~restap_ifor_test_base.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + test_base_account_name, # type: str + test_summary_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestSummaryResource" + """Gets a Test Summary with specific name from all the Test Summaries of all the packages under a + Test Base Account. + + :param resource_group_name: The name of the resource group that contains the resource. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. + :type test_base_account_name: str + :param test_summary_name: The name of the Test Summary. + :type test_summary_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestSummaryResource, or the result of cls(response) + :rtype: ~restap_ifor_test_base.models.TestSummaryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestSummaryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-10-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'), + 'testBaseAccountName': self._serialize.url("test_base_account_name", test_base_account_name, 'str'), + 'testSummaryName': self._serialize.url("test_summary_name", test_summary_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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestSummaryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries/{testSummaryName}'} # type: ignore diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/py.typed b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/testbase/azure-mgmt-testbase/sdk_packaging.toml b/sdk/testbase/azure-mgmt-testbase/sdk_packaging.toml new file mode 100644 index 000000000000..4a362c30fb52 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-testbase" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/testbase/azure-mgmt-testbase/setup.cfg b/sdk/testbase/azure-mgmt-testbase/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/testbase/azure-mgmt-testbase/setup.py b/sdk/testbase/azure-mgmt-testbase/setup.py new file mode 100644 index 000000000000..36c3f146d59e --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-testbase" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/testbase/ci.yml b/sdk/testbase/ci.yml new file mode 100644 index 000000000000..c7e14bf32049 --- /dev/null +++ b/sdk/testbase/ci.yml @@ -0,0 +1,35 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/testbase/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/testbase/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: testbase + Artifacts: + - name: azure-mgmt-testbase + safeName: azuremgmttestbase