diff --git a/sdk/workloads/azure-mgmt-workloads/CHANGELOG.md b/sdk/workloads/azure-mgmt-workloads/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/workloads/azure-mgmt-workloads/LICENSE b/sdk/workloads/azure-mgmt-workloads/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/workloads/azure-mgmt-workloads/MANIFEST.in b/sdk/workloads/azure-mgmt-workloads/MANIFEST.in new file mode 100644 index 000000000000..404319565a61 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/MANIFEST.in @@ -0,0 +1,7 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/workloads/py.typed diff --git a/sdk/workloads/azure-mgmt-workloads/README.md b/sdk/workloads/azure-mgmt-workloads/README.md new file mode 100644 index 000000000000..32219a1f460a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/README.md @@ -0,0 +1,30 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +# 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-workloads%2FREADME.png) diff --git a/sdk/workloads/azure-mgmt-workloads/_meta.json b/sdk/workloads/azure-mgmt-workloads/_meta.json new file mode 100644 index 000000000000..41e0690321c2 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.13.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "e97aef1e077b062e4a861fc940e3f3346c941829", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/workloads/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/workloads/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/__init__.py new file mode 100644 index 000000000000..8f2b5059c9df --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/__init__.py @@ -0,0 +1,18 @@ +# 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 ._workloads_client import WorkloadsClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['WorkloadsClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py new file mode 100644 index 000000000000..bef7edc93f1c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py @@ -0,0 +1,73 @@ +# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class WorkloadsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for WorkloadsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(WorkloadsClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-workloads/{}'.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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_metadata.json b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_metadata.json new file mode 100644 index 000000000000..bc7c431b8124 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_metadata.json @@ -0,0 +1,165 @@ +{ + "chosen_version": "2021-12-01-preview", + "total_api_version_list": ["2021-12-01-preview"], + "client": { + "name": "WorkloadsClient", + "filename": "_workloads_client", + "description": "Workloads client provides access to various workload operations.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": 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\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"WorkloadsClientConfiguration\"], \"._operations_mixin\": [\"WorkloadsClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"WorkloadsClientConfiguration\"], \"._operations_mixin\": [\"WorkloadsClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", + "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "php_workloads": "PhpWorkloadsOperations", + "wordpress_instances": "WordpressInstancesOperations", + "sap_virtual_instances": "SAPVirtualInstancesOperations", + "sap_central_instances": "SAPCentralInstancesOperations", + "sap_database_instances": "SAPDatabaseInstancesOperations", + "sap_application_server_instances": "SAPApplicationServerInstancesOperations", + "operations": "Operations", + "monitors": "MonitorsOperations", + "provider_instances": "ProviderInstancesOperations", + "skus": "SkusOperations" + }, + "operation_mixins": { + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "operations": { + "sap_sizing_recommendations" : { + "sync": { + "signature": "def sap_sizing_recommendations(\n self,\n location, # type: str\n sap_sizing_recommendation=None, # type: Optional[\"_models.SAPSizingRecommendationRequest\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.SAPSizingRecommendationResult\"\n", + "doc": "\"\"\"Get SAP sizing recommendations.\n\n:param location: The name of Azure region.\n:type location: str\n:param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is\n None.\n:type sap_sizing_recommendation: ~azure.mgmt.workloads.models.SAPSizingRecommendationRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SAPSizingRecommendationResult, or the result of cls(response)\n:rtype: ~azure.mgmt.workloads.models.SAPSizingRecommendationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def sap_sizing_recommendations(\n self,\n location: str,\n sap_sizing_recommendation: Optional[\"_models.SAPSizingRecommendationRequest\"] = None,\n **kwargs: Any\n) -\u003e \"_models.SAPSizingRecommendationResult\":\n", + "doc": "\"\"\"Get SAP sizing recommendations.\n\n:param location: The name of Azure region.\n:type location: str\n:param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is\n None.\n:type sap_sizing_recommendation: ~azure.mgmt.workloads.models.SAPSizingRecommendationRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SAPSizingRecommendationResult, or the result of cls(response)\n:rtype: ~azure.mgmt.workloads.models.SAPSizingRecommendationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "location, sap_sizing_recommendation" + }, + "sap_supported_sku" : { + "sync": { + "signature": "def sap_supported_sku(\n self,\n location, # type: str\n sap_supported_sku=None, # type: Optional[\"_models.SAPSupportedSkusRequest\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.SAPSupportedResourceSkusResult\"\n", + "doc": "\"\"\"Get SAP supported SKUs.\n\n:param location: The name of Azure region.\n:type location: str\n:param sap_supported_sku: SAP Supported SKU Request body. Default value is None.\n:type sap_supported_sku: ~azure.mgmt.workloads.models.SAPSupportedSkusRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SAPSupportedResourceSkusResult, or the result of cls(response)\n:rtype: ~azure.mgmt.workloads.models.SAPSupportedResourceSkusResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def sap_supported_sku(\n self,\n location: str,\n sap_supported_sku: Optional[\"_models.SAPSupportedSkusRequest\"] = None,\n **kwargs: Any\n) -\u003e \"_models.SAPSupportedResourceSkusResult\":\n", + "doc": "\"\"\"Get SAP supported SKUs.\n\n:param location: The name of Azure region.\n:type location: str\n:param sap_supported_sku: SAP Supported SKU Request body. Default value is None.\n:type sap_supported_sku: ~azure.mgmt.workloads.models.SAPSupportedSkusRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SAPSupportedResourceSkusResult, or the result of cls(response)\n:rtype: ~azure.mgmt.workloads.models.SAPSupportedResourceSkusResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "location, sap_supported_sku" + }, + "sap_disk_configurations" : { + "sync": { + "signature": "def sap_disk_configurations(\n self,\n location, # type: str\n sap_disk_configurations=None, # type: Optional[\"_models.SAPDiskConfigurationsRequest\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.SAPDiskConfigurationsResult\"\n", + "doc": "\"\"\"Get SAP Disk Configurations.\n\n:param location: The name of Azure region.\n:type location: str\n:param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None.\n:type sap_disk_configurations: ~azure.mgmt.workloads.models.SAPDiskConfigurationsRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SAPDiskConfigurationsResult, or the result of cls(response)\n:rtype: ~azure.mgmt.workloads.models.SAPDiskConfigurationsResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def sap_disk_configurations(\n self,\n location: str,\n sap_disk_configurations: Optional[\"_models.SAPDiskConfigurationsRequest\"] = None,\n **kwargs: Any\n) -\u003e \"_models.SAPDiskConfigurationsResult\":\n", + "doc": "\"\"\"Get SAP Disk Configurations.\n\n:param location: The name of Azure region.\n:type location: str\n:param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None.\n:type sap_disk_configurations: ~azure.mgmt.workloads.models.SAPDiskConfigurationsRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SAPDiskConfigurationsResult, or the result of cls(response)\n:rtype: ~azure.mgmt.workloads.models.SAPDiskConfigurationsResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "location, sap_disk_configurations" + }, + "sap_availability_zone_details" : { + "sync": { + "signature": "def sap_availability_zone_details(\n self,\n location, # type: str\n sap_availability_zone_details=None, # type: Optional[\"_models.SAPAvailabilityZoneDetailsRequest\"]\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.SAPAvailabilityZoneDetailsResult\"\n", + "doc": "\"\"\"Get SAP Availability Zone Details.\n\n:param location: The name of Azure region.\n:type location: str\n:param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value\n is None.\n:type sap_availability_zone_details:\n ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SAPAvailabilityZoneDetailsResult, or the result of cls(response)\n:rtype: ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def sap_availability_zone_details(\n self,\n location: str,\n sap_availability_zone_details: Optional[\"_models.SAPAvailabilityZoneDetailsRequest\"] = None,\n **kwargs: Any\n) -\u003e \"_models.SAPAvailabilityZoneDetailsResult\":\n", + "doc": "\"\"\"Get SAP Availability Zone Details.\n\n:param location: The name of Azure region.\n:type location: str\n:param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value\n is None.\n:type sap_availability_zone_details:\n ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SAPAvailabilityZoneDetailsResult, or the result of cls(response)\n:rtype: ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "location, sap_availability_zone_details" + } + } + } +} \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_patch.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_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/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.py new file mode 100644 index 000000000000..253419521122 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_client.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 copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import WorkloadsClientConfiguration +from .operations import MonitorsOperations, Operations, PhpWorkloadsOperations, ProviderInstancesOperations, SAPApplicationServerInstancesOperations, SAPCentralInstancesOperations, SAPDatabaseInstancesOperations, SAPVirtualInstancesOperations, SkusOperations, WordpressInstancesOperations, WorkloadsClientOperationsMixin + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class WorkloadsClient(WorkloadsClientOperationsMixin): # pylint: disable=too-many-instance-attributes + """Workloads client provides access to various workload operations. + + :ivar php_workloads: PhpWorkloadsOperations operations + :vartype php_workloads: azure.mgmt.workloads.operations.PhpWorkloadsOperations + :ivar wordpress_instances: WordpressInstancesOperations operations + :vartype wordpress_instances: azure.mgmt.workloads.operations.WordpressInstancesOperations + :ivar sap_virtual_instances: SAPVirtualInstancesOperations operations + :vartype sap_virtual_instances: azure.mgmt.workloads.operations.SAPVirtualInstancesOperations + :ivar sap_central_instances: SAPCentralInstancesOperations operations + :vartype sap_central_instances: azure.mgmt.workloads.operations.SAPCentralInstancesOperations + :ivar sap_database_instances: SAPDatabaseInstancesOperations operations + :vartype sap_database_instances: azure.mgmt.workloads.operations.SAPDatabaseInstancesOperations + :ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations + :vartype sap_application_server_instances: + azure.mgmt.workloads.operations.SAPApplicationServerInstancesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloads.operations.Operations + :ivar monitors: MonitorsOperations operations + :vartype monitors: azure.mgmt.workloads.operations.MonitorsOperations + :ivar provider_instances: ProviderInstancesOperations operations + :vartype provider_instances: azure.mgmt.workloads.operations.ProviderInstancesOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.workloads.operations.SkusOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = WorkloadsClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.php_workloads = PhpWorkloadsOperations(self._client, self._config, self._serialize, self._deserialize) + self.wordpress_instances = WordpressInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_virtual_instances = SAPVirtualInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_central_instances = SAPCentralInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_database_instances = SAPDatabaseInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_application_server_instances = SAPApplicationServerInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.provider_instances = ProviderInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WorkloadsClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/__init__.py new file mode 100644 index 000000000000..0d869187c5dd --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/__init__.py @@ -0,0 +1,15 @@ +# 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 ._workloads_client import WorkloadsClient +__all__ = ['WorkloadsClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py new file mode 100644 index 000000000000..61293a606e85 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py @@ -0,0 +1,72 @@ +# 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, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class WorkloadsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for WorkloadsClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(WorkloadsClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-workloads/{}'.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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_patch.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.py new file mode 100644 index 000000000000..e46fe69426e1 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_client.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 copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import WorkloadsClientConfiguration +from .operations import MonitorsOperations, Operations, PhpWorkloadsOperations, ProviderInstancesOperations, SAPApplicationServerInstancesOperations, SAPCentralInstancesOperations, SAPDatabaseInstancesOperations, SAPVirtualInstancesOperations, SkusOperations, WordpressInstancesOperations, WorkloadsClientOperationsMixin + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class WorkloadsClient(WorkloadsClientOperationsMixin): # pylint: disable=too-many-instance-attributes + """Workloads client provides access to various workload operations. + + :ivar php_workloads: PhpWorkloadsOperations operations + :vartype php_workloads: azure.mgmt.workloads.aio.operations.PhpWorkloadsOperations + :ivar wordpress_instances: WordpressInstancesOperations operations + :vartype wordpress_instances: azure.mgmt.workloads.aio.operations.WordpressInstancesOperations + :ivar sap_virtual_instances: SAPVirtualInstancesOperations operations + :vartype sap_virtual_instances: + azure.mgmt.workloads.aio.operations.SAPVirtualInstancesOperations + :ivar sap_central_instances: SAPCentralInstancesOperations operations + :vartype sap_central_instances: + azure.mgmt.workloads.aio.operations.SAPCentralInstancesOperations + :ivar sap_database_instances: SAPDatabaseInstancesOperations operations + :vartype sap_database_instances: + azure.mgmt.workloads.aio.operations.SAPDatabaseInstancesOperations + :ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations + :vartype sap_application_server_instances: + azure.mgmt.workloads.aio.operations.SAPApplicationServerInstancesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloads.aio.operations.Operations + :ivar monitors: MonitorsOperations operations + :vartype monitors: azure.mgmt.workloads.aio.operations.MonitorsOperations + :ivar provider_instances: ProviderInstancesOperations operations + :vartype provider_instances: azure.mgmt.workloads.aio.operations.ProviderInstancesOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.workloads.aio.operations.SkusOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = WorkloadsClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.php_workloads = PhpWorkloadsOperations(self._client, self._config, self._serialize, self._deserialize) + self.wordpress_instances = WordpressInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_virtual_instances = SAPVirtualInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_central_instances = SAPCentralInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_database_instances = SAPDatabaseInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sap_application_server_instances = SAPApplicationServerInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.provider_instances = ProviderInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WorkloadsClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py new file mode 100644 index 000000000000..776a9a684ec2 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._php_workloads_operations import PhpWorkloadsOperations +from ._wordpress_instances_operations import WordpressInstancesOperations +from ._workloads_client_operations import WorkloadsClientOperationsMixin +from ._sap_virtual_instances_operations import SAPVirtualInstancesOperations +from ._sap_central_instances_operations import SAPCentralInstancesOperations +from ._sap_database_instances_operations import SAPDatabaseInstancesOperations +from ._sap_application_server_instances_operations import SAPApplicationServerInstancesOperations +from ._operations import Operations +from ._monitors_operations import MonitorsOperations +from ._provider_instances_operations import ProviderInstancesOperations +from ._skus_operations import SkusOperations + +__all__ = [ + 'PhpWorkloadsOperations', + 'WordpressInstancesOperations', + 'WorkloadsClientOperationsMixin', + 'SAPVirtualInstancesOperations', + 'SAPCentralInstancesOperations', + 'SAPDatabaseInstancesOperations', + 'SAPApplicationServerInstancesOperations', + 'Operations', + 'MonitorsOperations', + 'ProviderInstancesOperations', + 'SkusOperations', +] diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py new file mode 100644 index 000000000000..7db6cb23ed09 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py @@ -0,0 +1,578 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._monitors_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitorsOperations: + """MonitorsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.MonitorListResult"]: + """Gets a list of SAP monitors in the specified subscription. + + Gets a list of SAP monitors in the specified subscription. The operations returns various + properties of each SAP monitor. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitorListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.MonitorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MonitorListResult", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/monitors"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MonitorListResult"]: + """Gets a list of SAP monitors. + + Gets a list of SAP monitors in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitorListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.MonitorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MonitorListResult", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/monitors"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.Monitor": + """Gets properties of a SAP monitor. + + Gets properties of a SAP monitor for the specified subscription, resource group, and resource + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Monitor, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.Monitor + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Monitor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + monitor_parameter: "_models.Monitor", + **kwargs: Any + ) -> "_models.Monitor": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitor_parameter, 'Monitor') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Monitor', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Monitor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + monitor_parameter: "_models.Monitor", + **kwargs: Any + ) -> AsyncLROPoller["_models.Monitor"]: + """Creates a SAP monitor. + + Creates a SAP monitor for the specified subscription, resource group, and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param monitor_parameter: Request body representing a SAP monitor. + :type monitor_parameter: ~azure.mgmt.workloads.models.Monitor + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Monitor or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.Monitor] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + 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, + monitor_name=monitor_name, + monitor_parameter=monitor_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Monitor', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationStatusResult"]: + """Deletes a SAP monitor. + + Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + monitor_name=monitor_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + monitor_name: str, + body: "_models.UpdateMonitorRequest", + **kwargs: Any + ) -> "_models.Monitor": + """Patches the Tags field of a SAP monitor. + + Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP + monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param body: The Update SAP workload monitor request body. + :type body: ~azure.mgmt.workloads.models.UpdateMonitorRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Monitor, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.Monitor + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'UpdateMonitorRequest') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Monitor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py new file mode 100644 index 000000000000..762c5bd0ae57 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py @@ -0,0 +1,116 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +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: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all the available API operations under this PR. + + :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[~azure.mgmt.workloads.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.Workloads/operations"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py new file mode 100644 index 000000000000..9f6e88ce32a3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_php_workloads_operations.py @@ -0,0 +1,564 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._php_workloads_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PhpWorkloadsOperations: + """PhpWorkloadsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PhpWorkloadResourceList"]: + """Lists PHP workload resources for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PhpWorkloadResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PhpWorkloadResourceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/phpWorkloads"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PhpWorkloadResourceList"]: + """Lists PHP workload resources in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PhpWorkloadResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PhpWorkloadResourceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/phpWorkloads"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any + ) -> "_models.PhpWorkloadResource": + """Gets the PHP workload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PhpWorkloadResource, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + php_workload_name: str, + php_workload_resource: "_models.PhpWorkloadResource", + **kwargs: Any + ) -> "_models.PhpWorkloadResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(php_workload_resource, 'PhpWorkloadResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + php_workload_name: str, + php_workload_resource: "_models.PhpWorkloadResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.PhpWorkloadResource"]: + """Create or updated PHP workload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :param php_workload_resource: Resource create or update request payload. + :type php_workload_resource: ~azure.mgmt.workloads.models.PhpWorkloadResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PhpWorkloadResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + php_workload_resource=php_workload_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + php_workload_name: str, + resource_patch_request_body: "_models.PatchResourceRequestBody", + **kwargs: Any + ) -> "_models.PhpWorkloadResource": + """Update PHP workload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :param resource_patch_request_body: Workload resource update data. + :type resource_patch_request_body: ~azure.mgmt.workloads.models.PatchResourceRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PhpWorkloadResource, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource_patch_request_body, 'PatchResourceRequestBody') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + php_workload_name: str, + delete_infra: Optional[str] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + delete_infra=delete_infra, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + php_workload_name: str, + delete_infra: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete PHP workload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :param delete_infra: Whether to delete infra along with workload resource. Default value is + None. + :type delete_infra: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + 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, + php_workload_name=php_workload_name, + delete_infra=delete_infra, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py new file mode 100644 index 000000000000..3840ad9fbc2c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py @@ -0,0 +1,460 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._provider_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProviderInstancesOperations: + """ProviderInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ProviderInstanceListResult"]: + """Gets a list of provider instances in the specified SAP monitor. + + Gets a list of provider instances in the specified SAP monitor. The operations returns various + properties of each provider instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.ProviderInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProviderInstanceListResult", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/monitors/{monitorName}/providerInstances"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + **kwargs: Any + ) -> "_models.ProviderInstance": + """Gets properties of a provider instance. + + Gets properties of a provider instance for the specified subscription, resource group, SAP + monitor name, and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param provider_instance_name: Name of the provider instance. + :type provider_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProviderInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.ProviderInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProviderInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + provider_instance_parameter: "_models.ProviderInstance", + **kwargs: Any + ) -> "_models.ProviderInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(provider_instance_parameter, 'ProviderInstance') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ProviderInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ProviderInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + provider_instance_parameter: "_models.ProviderInstance", + **kwargs: Any + ) -> AsyncLROPoller["_models.ProviderInstance"]: + """Creates a provider instance. + + Creates a provider instance for the specified subscription, resource group, SAP monitor name, + and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param provider_instance_name: Name of the provider instance. + :type provider_instance_name: str + :param provider_instance_parameter: Request body representing a provider instance. + :type provider_instance_parameter: ~azure.mgmt.workloads.models.ProviderInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ProviderInstance or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.ProviderInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] + 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, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + provider_instance_parameter=provider_instance_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ProviderInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationStatusResult"]: + """Deletes a provider instance. + + Deletes a provider instance for the specified subscription, resource group, SAP monitor name, + and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param provider_instance_name: Name of the provider instance. + :type provider_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py new file mode 100644 index 000000000000..043d822c2afc --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py @@ -0,0 +1,591 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_application_server_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SAPApplicationServerInstancesOperations: + """SAPApplicationServerInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + **kwargs: Any + ) -> "_models.SAPApplicationServerInstance": + """Gets the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPApplicationServerInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPApplicationServerInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional["_models.SAPApplicationServerInstance"] = None, + **kwargs: Any + ) -> "_models.SAPApplicationServerInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SAPApplicationServerInstance') + else: + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional["_models.SAPApplicationServerInstance"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.SAPApplicationServerInstance"]: + """Puts the SAP Application Server Instance. :code:`
`:code:`
`This will be used by service + only. PUT by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance. + :type application_instance_name: str + :param body: The SAP Application Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.SAPApplicationServerInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPApplicationServerInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional["_models.UpdateSAPApplicationInstanceRequest"] = None, + **kwargs: Any + ) -> "_models.SAPApplicationServerInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'UpdateSAPApplicationInstanceRequest') + else: + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional["_models.UpdateSAPApplicationInstanceRequest"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.SAPApplicationServerInstance"]: + """Puts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance. + :type application_instance_name: str + :param body: The SAP Application Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.UpdateSAPApplicationInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPApplicationServerInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationStatusResult"]: + """Deletes the SAP Application Server Instance. :code:`
`:code:`
`This operation will be + used by service only. Delete by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SAPApplicationServerInstanceList"]: + """Lists the SAP Application server Instances in an SVI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPApplicationServerInstanceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPApplicationServerInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SAPApplicationServerInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py new file mode 100644 index 000000000000..8c2fd0f3be64 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py @@ -0,0 +1,595 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_central_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SAPCentralInstancesOperations: + """SAPCentralInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + **kwargs: Any + ) -> "_models.SAPCentralServerInstance": + """Gets the SAP Central Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Instance name string modeled as parameter for auto + generation to work correctly. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPCentralServerInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPCentralServerInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional["_models.SAPCentralServerInstance"] = None, + **kwargs: Any + ) -> "_models.SAPCentralServerInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SAPCentralServerInstance') + else: + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional["_models.SAPCentralServerInstance"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.SAPCentralServerInstance"]: + """Puts the SAP Central Instance. :code:`
`:code:`
`This will be used by service only. PUT + by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Instance name string modeled as parameter for auto + generation to work correctly. + :type central_instance_name: str + :param body: The SAP Central Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.SAPCentralServerInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional["_models.UpdateSAPCentralInstanceRequest"] = None, + **kwargs: Any + ) -> "_models.SAPCentralServerInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'UpdateSAPCentralInstanceRequest') + else: + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional["_models.UpdateSAPCentralInstanceRequest"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.SAPCentralServerInstance"]: + """Updates the SAP Central Instance. :code:`
`:code:`
`This can be used to update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Instance name string modeled as parameter for auto + generation to work correctly. + :type central_instance_name: str + :param body: The SAP Central Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.UpdateSAPCentralInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationStatusResult"]: + """Deletes the SAP Central Instance. :code:`
`:code:`
`This will be used by service only. + Delete by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Instance name string modeled as parameter for auto + generation to work correctly. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SAPCentralInstanceList"]: + """Lists the SAP Central Instances in an SVI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPCentralInstanceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPCentralInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SAPCentralInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py new file mode 100644 index 000000000000..e13cff2a6c2b --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py @@ -0,0 +1,593 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_database_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SAPDatabaseInstancesOperations: + """SAPDatabaseInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + **kwargs: Any + ) -> "_models.SAPDatabaseInstance": + """Gets the SAP Database Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param database_instance_name: Database Instance string modeled as parameter for auto + generation to work correctly. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDatabaseInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPDatabaseInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional["_models.SAPDatabaseInstance"] = None, + **kwargs: Any + ) -> "_models.SAPDatabaseInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SAPDatabaseInstance') + else: + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional["_models.SAPDatabaseInstance"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.SAPDatabaseInstance"]: + """Puts the SAP Database Instance. :code:`
`:code:`
`This will be used by service only. PUT + by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param database_instance_name: Database Instance string modeled as parameter for auto + generation to work correctly. + :type database_instance_name: str + :param body: The SAP Database Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.SAPDatabaseInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional["_models.UpdateSAPDatabaseInstanceRequest"] = None, + **kwargs: Any + ) -> "_models.SAPDatabaseInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'UpdateSAPDatabaseInstanceRequest') + else: + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional["_models.UpdateSAPDatabaseInstanceRequest"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.SAPDatabaseInstance"]: + """Puts the SAP Database Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param database_instance_name: Database Instance string modeled as parameter for auto + generation to work correctly. + :type database_instance_name: str + :param body: The SAP Database Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.UpdateSAPDatabaseInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationStatusResult"]: + """Deletes the SAP Database Instance. :code:`
`:code:`
`This will be used by service only. + Delete by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param database_instance_name: Database Instance string modeled as parameter for auto + generation to work correctly. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SAPDatabaseInstanceList"]: + """Lists the SAP Database Instances in an SVI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPDatabaseInstanceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPDatabaseInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SAPDatabaseInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py new file mode 100644 index 000000000000..da0c4c108042 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py @@ -0,0 +1,815 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sap_virtual_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_start_request_initial, build_stop_request_initial, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SAPVirtualInstancesOperations: + """SAPVirtualInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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, + sap_virtual_instance_name: str, + body: Optional["_models.SAPVirtualInstance"] = None, + **kwargs: Any + ) -> "_models.SAPVirtualInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SAPVirtualInstance') + else: + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional["_models.SAPVirtualInstance"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.SAPVirtualInstance"]: + """Creates an Virtual Instance for SAP. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.SAPVirtualInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPVirtualInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> "_models.SAPVirtualInstance": + """Gets an Virtual Instance for SAP. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPVirtualInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional["_models.UpdateSAPVirtualInstanceRequest"] = None, + **kwargs: Any + ) -> "_models.SAPVirtualInstance": + """Updates an Virtual Instance for SAP. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param body: The Update Virtual Instance for SAP request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.UpdateSAPVirtualInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPVirtualInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'UpdateSAPVirtualInstanceRequest') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationStatusResult"]: + """Deletes an Virtual Instance for SAP. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SAPVirtualInstanceList"]: + """Gets all Virtual Instances for SAP in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPVirtualInstanceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPVirtualInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SAPVirtualInstanceList"]: + """Gets all Virtual Instances for SAP in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPVirtualInstanceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SAPVirtualInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances"} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationStatusResult"]: + """Starts the SAP System. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start"} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional["_models.StopRequest"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'StopRequest') + else: + _json = None + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop"} # type: ignore + + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional["_models.StopRequest"] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationStatusResult"]: + """Stops the SAP System. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param body: The Virtual Instances for SAP stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py new file mode 100644 index 000000000000..9096a0722626 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_skus_operations.py @@ -0,0 +1,117 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request +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: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SkusListResult"]: + """Lists all the available SKUs under this PR. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkusListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.SkusListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SkusListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SkusListResult", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/skus"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py new file mode 100644 index 000000000000..1d833807b0f7 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_wordpress_instances_operations.py @@ -0,0 +1,374 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._wordpress_instances_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WordpressInstancesOperations: + """WordpressInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WordpressInstanceResourceList"]: + """Lists WordPress instance resources under a phpWorkload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WordpressInstanceResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.WordpressInstanceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WordpressInstanceResourceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any + ) -> "_models.WordpressInstanceResource": + """Gets the WordPress instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WordpressInstanceResource, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.WordpressInstanceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + php_workload_name: str, + wordpress_instance_resource: "_models.WordpressInstanceResource", + **kwargs: Any + ) -> "_models.WordpressInstanceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(wordpress_instance_resource, 'WordpressInstanceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + php_workload_name: str, + wordpress_instance_resource: "_models.WordpressInstanceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.WordpressInstanceResource"]: + """Create or updated WordPress instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :param wordpress_instance_resource: Resource create or update request payload. + :type wordpress_instance_resource: ~azure.mgmt.workloads.models.WordpressInstanceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WordpressInstanceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + wordpress_instance_resource=wordpress_instance_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default"} # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any + ) -> None: + """Delete WordPress instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_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 = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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, pipeline_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.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default"} # type: ignore + diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py new file mode 100644 index 000000000000..205822951ef8 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_client_operations.py @@ -0,0 +1,287 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._workloads_client_operations import build_sap_availability_zone_details_request, build_sap_disk_configurations_request, build_sap_sizing_recommendations_request, build_sap_supported_sku_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkloadsClientOperationsMixin: + + @distributed_trace_async + async def sap_sizing_recommendations( + self, + location: str, + sap_sizing_recommendation: Optional["_models.SAPSizingRecommendationRequest"] = None, + **kwargs: Any + ) -> "_models.SAPSizingRecommendationResult": + """Get SAP sizing recommendations. + + :param location: The name of Azure region. + :type location: str + :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is + None. + :type sap_sizing_recommendation: ~azure.mgmt.workloads.models.SAPSizingRecommendationRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSizingRecommendationResult, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPSizingRecommendationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPSizingRecommendationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if sap_sizing_recommendation is not None: + _json = self._serialize.body(sap_sizing_recommendation, 'SAPSizingRecommendationRequest') + else: + _json = None + + request = build_sap_sizing_recommendations_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.sap_sizing_recommendations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPSizingRecommendationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_sizing_recommendations.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations"} # type: ignore + + + @distributed_trace_async + async def sap_supported_sku( + self, + location: str, + sap_supported_sku: Optional["_models.SAPSupportedSkusRequest"] = None, + **kwargs: Any + ) -> "_models.SAPSupportedResourceSkusResult": + """Get SAP supported SKUs. + + :param location: The name of Azure region. + :type location: str + :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. + :type sap_supported_sku: ~azure.mgmt.workloads.models.SAPSupportedSkusRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSupportedResourceSkusResult, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPSupportedResourceSkusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPSupportedResourceSkusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if sap_supported_sku is not None: + _json = self._serialize.body(sap_supported_sku, 'SAPSupportedSkusRequest') + else: + _json = None + + request = build_sap_supported_sku_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.sap_supported_sku.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPSupportedResourceSkusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_supported_sku.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku"} # type: ignore + + + @distributed_trace_async + async def sap_disk_configurations( + self, + location: str, + sap_disk_configurations: Optional["_models.SAPDiskConfigurationsRequest"] = None, + **kwargs: Any + ) -> "_models.SAPDiskConfigurationsResult": + """Get SAP Disk Configurations. + + :param location: The name of Azure region. + :type location: str + :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. + :type sap_disk_configurations: ~azure.mgmt.workloads.models.SAPDiskConfigurationsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDiskConfigurationsResult, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPDiskConfigurationsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDiskConfigurationsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if sap_disk_configurations is not None: + _json = self._serialize.body(sap_disk_configurations, 'SAPDiskConfigurationsRequest') + else: + _json = None + + request = build_sap_disk_configurations_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.sap_disk_configurations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPDiskConfigurationsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_disk_configurations.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations"} # type: ignore + + + @distributed_trace_async + async def sap_availability_zone_details( + self, + location: str, + sap_availability_zone_details: Optional["_models.SAPAvailabilityZoneDetailsRequest"] = None, + **kwargs: Any + ) -> "_models.SAPAvailabilityZoneDetailsResult": + """Get SAP Availability Zone Details. + + :param location: The name of Azure region. + :type location: str + :param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value + is None. + :type sap_availability_zone_details: + ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPAvailabilityZoneDetailsResult, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPAvailabilityZoneDetailsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if sap_availability_zone_details is not None: + _json = self._serialize.body(sap_availability_zone_details, 'SAPAvailabilityZoneDetailsRequest') + else: + _json = None + + request = build_sap_availability_zone_details_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.sap_availability_zone_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPAvailabilityZoneDetailsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_availability_zone_details.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails"} # type: ignore + diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py new file mode 100644 index 000000000000..232cc6f9e567 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/__init__.py @@ -0,0 +1,367 @@ +# 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 ._models_py3 import ApplicationServerConfiguration +from ._models_py3 import BackupProfile +from ._models_py3 import CacheProfile +from ._models_py3 import CentralServerConfiguration +from ._models_py3 import CentralServerVmDetails +from ._models_py3 import DB2ProviderInstanceProperties +from ._models_py3 import DatabaseConfiguration +from ._models_py3 import DatabaseProfile +from ._models_py3 import DatabaseVmDetails +from ._models_py3 import DeployerVmPackages +from ._models_py3 import DeploymentConfiguration +from ._models_py3 import DeploymentWithOSConfiguration +from ._models_py3 import DiscoveryConfiguration +from ._models_py3 import DiskInfo +from ._models_py3 import EnqueueReplicationServerProperties +from ._models_py3 import EnqueueServerProperties +from ._models_py3 import Error +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorInnerError +from ._models_py3 import ErrorResponse +from ._models_py3 import FileshareProfile +from ._models_py3 import GatewayServerProperties +from ._models_py3 import HanaDbProviderInstanceProperties +from ._models_py3 import HighAvailabilityConfiguration +from ._models_py3 import HighAvailabilitySoftwareConfiguration +from ._models_py3 import ImageReference +from ._models_py3 import InfrastructureConfiguration +from ._models_py3 import LinuxConfiguration +from ._models_py3 import ManagedRGConfiguration +from ._models_py3 import MessageServerProperties +from ._models_py3 import Monitor +from ._models_py3 import MonitorListResult +from ._models_py3 import MonitorPropertiesErrors +from ._models_py3 import MsSqlServerProviderInstanceProperties +from ._models_py3 import NetworkConfiguration +from ._models_py3 import NetworkProfile +from ._models_py3 import NodeProfile +from ._models_py3 import OSConfiguration +from ._models_py3 import OSProfile +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationStatusResult +from ._models_py3 import OperationsContent +from ._models_py3 import OperationsDefinition +from ._models_py3 import OperationsDefinitionArrayResponseWithContinuation +from ._models_py3 import OperationsDefinitionDisplay +from ._models_py3 import OperationsDisplayDefinition +from ._models_py3 import OsImageProfile +from ._models_py3 import OsSapConfiguration +from ._models_py3 import PatchResourceRequestBody +from ._models_py3 import PatchResourceRequestBodyIdentity +from ._models_py3 import PhpProfile +from ._models_py3 import PhpWorkloadResource +from ._models_py3 import PhpWorkloadResourceIdentity +from ._models_py3 import PhpWorkloadResourceList +from ._models_py3 import PrometheusHaClusterProviderInstanceProperties +from ._models_py3 import PrometheusOSProviderInstanceProperties +from ._models_py3 import ProviderInstance +from ._models_py3 import ProviderInstanceListResult +from ._models_py3 import ProviderInstancePropertiesErrors +from ._models_py3 import ProviderSpecificProperties +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import RestrictionInfo +from ._models_py3 import SAPApplicationServerInstance +from ._models_py3 import SAPApplicationServerInstanceList +from ._models_py3 import SAPAvailabilityZoneDetailsRequest +from ._models_py3 import SAPAvailabilityZoneDetailsResult +from ._models_py3 import SAPAvailabilityZonePair +from ._models_py3 import SAPCentralInstanceList +from ._models_py3 import SAPCentralServerInstance +from ._models_py3 import SAPConfiguration +from ._models_py3 import SAPDatabaseInstance +from ._models_py3 import SAPDatabaseInstanceList +from ._models_py3 import SAPDiskConfiguration +from ._models_py3 import SAPDiskConfigurationsRequest +from ._models_py3 import SAPDiskConfigurationsResult +from ._models_py3 import SAPInstallWithoutOSConfigSoftwareConfiguration +from ._models_py3 import SAPSizingRecommendationRequest +from ._models_py3 import SAPSizingRecommendationResult +from ._models_py3 import SAPSupportedResourceSkusResult +from ._models_py3 import SAPSupportedSku +from ._models_py3 import SAPSupportedSkusRequest +from ._models_py3 import SAPVirtualInstance +from ._models_py3 import SAPVirtualInstanceError +from ._models_py3 import SAPVirtualInstanceList +from ._models_py3 import SapNetWeaverProviderInstanceProperties +from ._models_py3 import SearchProfile +from ._models_py3 import ServiceInitiatedSoftwareConfiguration +from ._models_py3 import SingleServerConfiguration +from ._models_py3 import SingleServerRecommendationResult +from ._models_py3 import SiteProfile +from ._models_py3 import Sku +from ._models_py3 import SkuCapability +from ._models_py3 import SkuCapacity +from ._models_py3 import SkuCost +from ._models_py3 import SkuDefinition +from ._models_py3 import SkuLocationAndZones +from ._models_py3 import SkuRestriction +from ._models_py3 import SkuZoneDetail +from ._models_py3 import SkusListResult +from ._models_py3 import SoftwareConfiguration +from ._models_py3 import SshConfiguration +from ._models_py3 import SshKeyPair +from ._models_py3 import SshPublicKey +from ._models_py3 import StopRequest +from ._models_py3 import SystemData +from ._models_py3 import Tags +from ._models_py3 import ThreeTierConfiguration +from ._models_py3 import ThreeTierRecommendationResult +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateMonitorRequest +from ._models_py3 import UpdateSAPApplicationInstanceRequest +from ._models_py3 import UpdateSAPCentralInstanceRequest +from ._models_py3 import UpdateSAPDatabaseInstanceRequest +from ._models_py3 import UpdateSAPVirtualInstanceRequest +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserAssignedServiceIdentity +from ._models_py3 import UserProfile +from ._models_py3 import VirtualMachineConfiguration +from ._models_py3 import VmssNodesProfile +from ._models_py3 import WindowsConfiguration +from ._models_py3 import WordpressInstanceResource +from ._models_py3 import WordpressInstanceResourceList + + +from ._workloads_client_enums import ( + ActionType, + ApplicationProvisioningState, + AzureFrontDoorEnabled, + CentralServerVirtualMachineType, + CreatedByType, + DatabaseTier, + DatabaseType, + DiskStorageType, + EnableBackup, + EnableSslEnforcement, + EnqueueReplicationServerType, + FileShareStorageType, + FileShareType, + HAEnabled, + LoadBalancerType, + LocationType, + ManagedServiceIdentityType, + OSImageOffer, + OSImagePublisher, + OSImageSku, + OSImageVersion, + OSType, + OperationProperties, + Origin, + PHPVersion, + PhpWorkloadProvisioningState, + RedisCacheFamily, + RoutingPreference, + SAPConfigurationType, + SAPDatabaseScaleMethod, + SAPDatabaseType, + SAPDeploymentType, + SAPEnvironmentType, + SAPHealthState, + SAPHighAvailabilityType, + SAPProductType, + SAPSoftwareInstallationType, + SAPVirtualInstanceState, + SAPVirtualInstanceStatus, + SapVirtualInstanceProvisioningState, + SearchType, + SkuRestrictionReasonCode, + SkuRestrictionType, + SkuScaleType, + SkuTier, + WordpressVersions, + WorkloadKind, + WorkloadMonitorActionType, + WorkloadMonitorProvisioningState, +) + +__all__ = [ + 'ApplicationServerConfiguration', + 'BackupProfile', + 'CacheProfile', + 'CentralServerConfiguration', + 'CentralServerVmDetails', + 'DB2ProviderInstanceProperties', + 'DatabaseConfiguration', + 'DatabaseProfile', + 'DatabaseVmDetails', + 'DeployerVmPackages', + 'DeploymentConfiguration', + 'DeploymentWithOSConfiguration', + 'DiscoveryConfiguration', + 'DiskInfo', + 'EnqueueReplicationServerProperties', + 'EnqueueServerProperties', + 'Error', + 'ErrorAdditionalInfo', + 'ErrorDefinition', + 'ErrorDetail', + 'ErrorInnerError', + 'ErrorResponse', + 'FileshareProfile', + 'GatewayServerProperties', + 'HanaDbProviderInstanceProperties', + 'HighAvailabilityConfiguration', + 'HighAvailabilitySoftwareConfiguration', + 'ImageReference', + 'InfrastructureConfiguration', + 'LinuxConfiguration', + 'ManagedRGConfiguration', + 'MessageServerProperties', + 'Monitor', + 'MonitorListResult', + 'MonitorPropertiesErrors', + 'MsSqlServerProviderInstanceProperties', + 'NetworkConfiguration', + 'NetworkProfile', + 'NodeProfile', + 'OSConfiguration', + 'OSProfile', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'OperationStatusResult', + 'OperationsContent', + 'OperationsDefinition', + 'OperationsDefinitionArrayResponseWithContinuation', + 'OperationsDefinitionDisplay', + 'OperationsDisplayDefinition', + 'OsImageProfile', + 'OsSapConfiguration', + 'PatchResourceRequestBody', + 'PatchResourceRequestBodyIdentity', + 'PhpProfile', + 'PhpWorkloadResource', + 'PhpWorkloadResourceIdentity', + 'PhpWorkloadResourceList', + 'PrometheusHaClusterProviderInstanceProperties', + 'PrometheusOSProviderInstanceProperties', + 'ProviderInstance', + 'ProviderInstanceListResult', + 'ProviderInstancePropertiesErrors', + 'ProviderSpecificProperties', + 'ProxyResource', + 'Resource', + 'RestrictionInfo', + 'SAPApplicationServerInstance', + 'SAPApplicationServerInstanceList', + 'SAPAvailabilityZoneDetailsRequest', + 'SAPAvailabilityZoneDetailsResult', + 'SAPAvailabilityZonePair', + 'SAPCentralInstanceList', + 'SAPCentralServerInstance', + 'SAPConfiguration', + 'SAPDatabaseInstance', + 'SAPDatabaseInstanceList', + 'SAPDiskConfiguration', + 'SAPDiskConfigurationsRequest', + 'SAPDiskConfigurationsResult', + 'SAPInstallWithoutOSConfigSoftwareConfiguration', + 'SAPSizingRecommendationRequest', + 'SAPSizingRecommendationResult', + 'SAPSupportedResourceSkusResult', + 'SAPSupportedSku', + 'SAPSupportedSkusRequest', + 'SAPVirtualInstance', + 'SAPVirtualInstanceError', + 'SAPVirtualInstanceList', + 'SapNetWeaverProviderInstanceProperties', + 'SearchProfile', + 'ServiceInitiatedSoftwareConfiguration', + 'SingleServerConfiguration', + 'SingleServerRecommendationResult', + 'SiteProfile', + 'Sku', + 'SkuCapability', + 'SkuCapacity', + 'SkuCost', + 'SkuDefinition', + 'SkuLocationAndZones', + 'SkuRestriction', + 'SkuZoneDetail', + 'SkusListResult', + 'SoftwareConfiguration', + 'SshConfiguration', + 'SshKeyPair', + 'SshPublicKey', + 'StopRequest', + 'SystemData', + 'Tags', + 'ThreeTierConfiguration', + 'ThreeTierRecommendationResult', + 'TrackedResource', + 'UpdateMonitorRequest', + 'UpdateSAPApplicationInstanceRequest', + 'UpdateSAPCentralInstanceRequest', + 'UpdateSAPDatabaseInstanceRequest', + 'UpdateSAPVirtualInstanceRequest', + 'UserAssignedIdentity', + 'UserAssignedServiceIdentity', + 'UserProfile', + 'VirtualMachineConfiguration', + 'VmssNodesProfile', + 'WindowsConfiguration', + 'WordpressInstanceResource', + 'WordpressInstanceResourceList', + 'ActionType', + 'ApplicationProvisioningState', + 'AzureFrontDoorEnabled', + 'CentralServerVirtualMachineType', + 'CreatedByType', + 'DatabaseTier', + 'DatabaseType', + 'DiskStorageType', + 'EnableBackup', + 'EnableSslEnforcement', + 'EnqueueReplicationServerType', + 'FileShareStorageType', + 'FileShareType', + 'HAEnabled', + 'LoadBalancerType', + 'LocationType', + 'ManagedServiceIdentityType', + 'OSImageOffer', + 'OSImagePublisher', + 'OSImageSku', + 'OSImageVersion', + 'OSType', + 'OperationProperties', + 'Origin', + 'PHPVersion', + 'PhpWorkloadProvisioningState', + 'RedisCacheFamily', + 'RoutingPreference', + 'SAPConfigurationType', + 'SAPDatabaseScaleMethod', + 'SAPDatabaseType', + 'SAPDeploymentType', + 'SAPEnvironmentType', + 'SAPHealthState', + 'SAPHighAvailabilityType', + 'SAPProductType', + 'SAPSoftwareInstallationType', + 'SAPVirtualInstanceState', + 'SAPVirtualInstanceStatus', + 'SapVirtualInstanceProvisioningState', + 'SearchType', + 'SkuRestrictionReasonCode', + 'SkuRestrictionType', + 'SkuScaleType', + 'SkuTier', + 'WordpressVersions', + 'WorkloadKind', + 'WorkloadMonitorActionType', + 'WorkloadMonitorProvisioningState', +] diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py new file mode 100644 index 000000000000..204f44536439 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py @@ -0,0 +1,6626 @@ +# 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 Any, Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._workloads_client_enums import * + + +class ApplicationServerConfiguration(msrest.serialization.Model): + """Gets or sets the application server configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar subnet_id: Required. The subnet id. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Required. Gets or sets the virtual machine configuration. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloads.models.VirtualMachineConfiguration + :ivar instance_count: Required. The number of app server instances. + :vartype instance_count: long + """ + + _validation = { + 'subnet_id': {'required': True}, + 'virtual_machine_configuration': {'required': True}, + 'instance_count': {'required': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'virtual_machine_configuration': {'key': 'virtualMachineConfiguration', 'type': 'VirtualMachineConfiguration'}, + 'instance_count': {'key': 'instanceCount', 'type': 'long'}, + } + + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "VirtualMachineConfiguration", + instance_count: int, + **kwargs + ): + """ + :keyword subnet_id: Required. The subnet id. + :paramtype subnet_id: str + :keyword virtual_machine_configuration: Required. Gets or sets the virtual machine + configuration. + :paramtype virtual_machine_configuration: + ~azure.mgmt.workloads.models.VirtualMachineConfiguration + :keyword instance_count: Required. The number of app server instances. + :paramtype instance_count: long + """ + super(ApplicationServerConfiguration, self).__init__(**kwargs) + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + self.instance_count = instance_count + + +class BackupProfile(msrest.serialization.Model): + """Backup profile. + + 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 backup_enabled: Required. Whether to enable Azure backup for the workload. Possible + values include: "Enabled", "Disabled". + :vartype backup_enabled: str or ~azure.mgmt.workloads.models.EnableBackup + :ivar vault_resource_id: Backup vault resource Id. + :vartype vault_resource_id: str + """ + + _validation = { + 'backup_enabled': {'required': True}, + 'vault_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'backup_enabled': {'key': 'backupEnabled', 'type': 'str'}, + 'vault_resource_id': {'key': 'vaultResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + backup_enabled: Union[str, "EnableBackup"], + **kwargs + ): + """ + :keyword backup_enabled: Required. Whether to enable Azure backup for the workload. Possible + values include: "Enabled", "Disabled". + :paramtype backup_enabled: str or ~azure.mgmt.workloads.models.EnableBackup + """ + super(BackupProfile, self).__init__(**kwargs) + self.backup_enabled = backup_enabled + self.vault_resource_id = None + + +class CacheProfile(msrest.serialization.Model): + """Cache profile. + + 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 name: Cache name. + :vartype name: str + :ivar sku_name: Required. Cache SKU name. + :vartype sku_name: str + :ivar family: Required. Cache family. Possible values include: "C", "P". + :vartype family: str or ~azure.mgmt.workloads.models.RedisCacheFamily + :ivar capacity: Required. Cache capacity. + :vartype capacity: long + :ivar cache_resource_id: Cache resource Id. + :vartype cache_resource_id: str + """ + + _validation = { + 'sku_name': {'required': True}, + 'family': {'required': True}, + 'capacity': {'required': True}, + 'cache_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'sku_name': {'key': 'skuName', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + 'cache_resource_id': {'key': 'cacheResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + sku_name: str, + family: Union[str, "RedisCacheFamily"], + capacity: int, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Cache name. + :paramtype name: str + :keyword sku_name: Required. Cache SKU name. + :paramtype sku_name: str + :keyword family: Required. Cache family. Possible values include: "C", "P". + :paramtype family: str or ~azure.mgmt.workloads.models.RedisCacheFamily + :keyword capacity: Required. Cache capacity. + :paramtype capacity: long + """ + super(CacheProfile, self).__init__(**kwargs) + self.name = name + self.sku_name = sku_name + self.family = family + self.capacity = capacity + self.cache_resource_id = None + + +class CentralServerConfiguration(msrest.serialization.Model): + """Gets or sets the central server configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar subnet_id: Required. The subnet id. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Required. Gets or sets the virtual machine configuration. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloads.models.VirtualMachineConfiguration + :ivar instance_count: Required. The number of central server VMs. + :vartype instance_count: long + """ + + _validation = { + 'subnet_id': {'required': True}, + 'virtual_machine_configuration': {'required': True}, + 'instance_count': {'required': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'virtual_machine_configuration': {'key': 'virtualMachineConfiguration', 'type': 'VirtualMachineConfiguration'}, + 'instance_count': {'key': 'instanceCount', 'type': 'long'}, + } + + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "VirtualMachineConfiguration", + instance_count: int, + **kwargs + ): + """ + :keyword subnet_id: Required. The subnet id. + :paramtype subnet_id: str + :keyword virtual_machine_configuration: Required. Gets or sets the virtual machine + configuration. + :paramtype virtual_machine_configuration: + ~azure.mgmt.workloads.models.VirtualMachineConfiguration + :keyword instance_count: Required. The number of central server VMs. + :paramtype instance_count: long + """ + super(CentralServerConfiguration, self).__init__(**kwargs) + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + self.instance_count = instance_count + + +class CentralServerVmDetails(msrest.serialization.Model): + """The Central Server VM Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Defines the type of central server VM. Possible values include: "Primary", + "Secondary", "Unknown", "ASCS", "ERSInactive", "ERS", "Standby". + :vartype type: str or ~azure.mgmt.workloads.models.CentralServerVirtualMachineType + :ivar virtual_machine_id: + :vartype virtual_machine_id: str + """ + + _validation = { + 'type': {'readonly': True}, + 'virtual_machine_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CentralServerVmDetails, self).__init__(**kwargs) + self.type = None + self.virtual_machine_id = None + + +class DatabaseConfiguration(msrest.serialization.Model): + """Gets or sets the database configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar database_type: The database type. Possible values include: "HANA", "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :ivar subnet_id: Required. The subnet id. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Required. Gets or sets the virtual machine configuration. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloads.models.VirtualMachineConfiguration + :ivar instance_count: Required. The number of database VMs. + :vartype instance_count: long + """ + + _validation = { + 'subnet_id': {'required': True}, + 'virtual_machine_configuration': {'required': True}, + 'instance_count': {'required': True}, + } + + _attribute_map = { + 'database_type': {'key': 'databaseType', 'type': 'str'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'virtual_machine_configuration': {'key': 'virtualMachineConfiguration', 'type': 'VirtualMachineConfiguration'}, + 'instance_count': {'key': 'instanceCount', 'type': 'long'}, + } + + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "VirtualMachineConfiguration", + instance_count: int, + database_type: Optional[Union[str, "SAPDatabaseType"]] = None, + **kwargs + ): + """ + :keyword database_type: The database type. Possible values include: "HANA", "DB2". + :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :keyword subnet_id: Required. The subnet id. + :paramtype subnet_id: str + :keyword virtual_machine_configuration: Required. Gets or sets the virtual machine + configuration. + :paramtype virtual_machine_configuration: + ~azure.mgmt.workloads.models.VirtualMachineConfiguration + :keyword instance_count: Required. The number of database VMs. + :paramtype instance_count: long + """ + super(DatabaseConfiguration, self).__init__(**kwargs) + self.database_type = database_type + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + self.instance_count = instance_count + + +class DatabaseProfile(msrest.serialization.Model): + """Workload database profile. + + 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 type: Required. Database type. Possible values include: "MySql". + :vartype type: str or ~azure.mgmt.workloads.models.DatabaseType + :ivar server_name: Database server name. + :vartype server_name: str + :ivar version: Database version. + :vartype version: str + :ivar sku: Required. The name of the server SKU, e.g. Standard_D32s_v4. + :vartype sku: str + :ivar tier: Required. Tier of the server SKU. Possible values include: "Burstable", + "GeneralPurpose", "MemoryOptimized". + :vartype tier: str or ~azure.mgmt.workloads.models.DatabaseTier + :ivar ha_enabled: Whether to enable HA for the server. Possible values include: "Enabled", + "Disabled". + :vartype ha_enabled: str or ~azure.mgmt.workloads.models.HAEnabled + :ivar storage_sku: SKU name for database storage. + :vartype storage_sku: str + :ivar storage_in_gb: Database storage size in GB. + :vartype storage_in_gb: long + :ivar storage_iops: Storage IOPS for the server. + :vartype storage_iops: long + :ivar backup_retention_days: Backup retention days for the server. + :vartype backup_retention_days: int + :ivar ssl_enforcement_enabled: Whether to enable SSL enforcement on the database. Possible + values include: "Enabled", "Disabled". + :vartype ssl_enforcement_enabled: str or ~azure.mgmt.workloads.models.EnableSslEnforcement + :ivar server_resource_id: Azure Database Server resource Id. + :vartype server_resource_id: str + """ + + _validation = { + 'type': {'required': True}, + 'sku': {'required': True}, + 'tier': {'required': True}, + 'storage_in_gb': {'minimum': 1}, + 'server_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'server_name': {'key': 'serverName', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'ha_enabled': {'key': 'haEnabled', 'type': 'str'}, + 'storage_sku': {'key': 'storageSku', 'type': 'str'}, + 'storage_in_gb': {'key': 'storageInGB', 'type': 'long'}, + 'storage_iops': {'key': 'storageIops', 'type': 'long'}, + 'backup_retention_days': {'key': 'backupRetentionDays', 'type': 'int'}, + 'ssl_enforcement_enabled': {'key': 'sslEnforcementEnabled', 'type': 'str'}, + 'server_resource_id': {'key': 'serverResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Union[str, "DatabaseType"], + sku: str, + tier: Union[str, "DatabaseTier"], + server_name: Optional[str] = None, + version: Optional[str] = None, + ha_enabled: Optional[Union[str, "HAEnabled"]] = None, + storage_sku: Optional[str] = None, + storage_in_gb: Optional[int] = None, + storage_iops: Optional[int] = None, + backup_retention_days: Optional[int] = None, + ssl_enforcement_enabled: Optional[Union[str, "EnableSslEnforcement"]] = None, + **kwargs + ): + """ + :keyword type: Required. Database type. Possible values include: "MySql". + :paramtype type: str or ~azure.mgmt.workloads.models.DatabaseType + :keyword server_name: Database server name. + :paramtype server_name: str + :keyword version: Database version. + :paramtype version: str + :keyword sku: Required. The name of the server SKU, e.g. Standard_D32s_v4. + :paramtype sku: str + :keyword tier: Required. Tier of the server SKU. Possible values include: "Burstable", + "GeneralPurpose", "MemoryOptimized". + :paramtype tier: str or ~azure.mgmt.workloads.models.DatabaseTier + :keyword ha_enabled: Whether to enable HA for the server. Possible values include: "Enabled", + "Disabled". + :paramtype ha_enabled: str or ~azure.mgmt.workloads.models.HAEnabled + :keyword storage_sku: SKU name for database storage. + :paramtype storage_sku: str + :keyword storage_in_gb: Database storage size in GB. + :paramtype storage_in_gb: long + :keyword storage_iops: Storage IOPS for the server. + :paramtype storage_iops: long + :keyword backup_retention_days: Backup retention days for the server. + :paramtype backup_retention_days: int + :keyword ssl_enforcement_enabled: Whether to enable SSL enforcement on the database. Possible + values include: "Enabled", "Disabled". + :paramtype ssl_enforcement_enabled: str or ~azure.mgmt.workloads.models.EnableSslEnforcement + """ + super(DatabaseProfile, self).__init__(**kwargs) + self.type = type + self.server_name = server_name + self.version = version + self.sku = sku + self.tier = tier + self.ha_enabled = ha_enabled + self.storage_sku = storage_sku + self.storage_in_gb = storage_in_gb + self.storage_iops = storage_iops + self.backup_retention_days = backup_retention_days + self.ssl_enforcement_enabled = ssl_enforcement_enabled + self.server_resource_id = None + + +class DatabaseVmDetails(msrest.serialization.Model): + """The Database VM Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar virtual_machine_id: + :vartype virtual_machine_id: str + :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable". + :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus + """ + + _validation = { + 'virtual_machine_id': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DatabaseVmDetails, self).__init__(**kwargs) + self.virtual_machine_id = None + self.status = None + + +class ProviderSpecificProperties(msrest.serialization.Model): + """Gets or sets the provider specific properties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: DB2ProviderInstanceProperties, MsSqlServerProviderInstanceProperties, PrometheusHaClusterProviderInstanceProperties, PrometheusOSProviderInstanceProperties, HanaDbProviderInstanceProperties, SapNetWeaverProviderInstanceProperties. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_type: Required. The provider type. For example, the value can be + SapHana.Constant filled by server. + :vartype provider_type: str + """ + + _validation = { + 'provider_type': {'required': True}, + } + + _attribute_map = { + 'provider_type': {'key': 'providerType', 'type': 'str'}, + } + + _subtype_map = { + 'provider_type': {'Db2': 'DB2ProviderInstanceProperties', 'MsSqlServer': 'MsSqlServerProviderInstanceProperties', 'PrometheusHaCluster': 'PrometheusHaClusterProviderInstanceProperties', 'PrometheusOS': 'PrometheusOSProviderInstanceProperties', 'SapHana': 'HanaDbProviderInstanceProperties', 'SapNetWeaver': 'SapNetWeaverProviderInstanceProperties'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProviderSpecificProperties, self).__init__(**kwargs) + self.provider_type = None # type: Optional[str] + + +class DB2ProviderInstanceProperties(ProviderSpecificProperties): + """Gets or sets the DB2 provider properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_type: Required. The provider type. For example, the value can be + SapHana.Constant filled by server. + :vartype provider_type: str + :ivar hostname: Gets or sets the target virtual machine name. + :vartype hostname: str + :ivar db_name: Gets or sets the db2 database name. + :vartype db_name: str + :ivar db_port: Gets or sets the db2 database sql port. + :vartype db_port: str + :ivar db_username: Gets or sets the db2 database user name. + :vartype db_username: str + :ivar db_password: Gets or sets the db2 database password. + :vartype db_password: str + :ivar db_password_uri: Gets or sets the key vault URI to secret with the database password. + :vartype db_password_uri: str + :ivar sap_sid: Gets or sets the SAP System Identifier. + :vartype sap_sid: str + """ + + _validation = { + 'provider_type': {'required': True}, + } + + _attribute_map = { + 'provider_type': {'key': 'providerType', 'type': 'str'}, + 'hostname': {'key': 'hostname', 'type': 'str'}, + 'db_name': {'key': 'dbName', 'type': 'str'}, + 'db_port': {'key': 'dbPort', 'type': 'str'}, + 'db_username': {'key': 'dbUsername', 'type': 'str'}, + 'db_password': {'key': 'dbPassword', 'type': 'str'}, + 'db_password_uri': {'key': 'dbPasswordUri', 'type': 'str'}, + 'sap_sid': {'key': 'sapSid', 'type': 'str'}, + } + + def __init__( + self, + *, + hostname: Optional[str] = None, + db_name: Optional[str] = None, + db_port: Optional[str] = None, + db_username: Optional[str] = None, + db_password: Optional[str] = None, + db_password_uri: Optional[str] = None, + sap_sid: Optional[str] = None, + **kwargs + ): + """ + :keyword hostname: Gets or sets the target virtual machine name. + :paramtype hostname: str + :keyword db_name: Gets or sets the db2 database name. + :paramtype db_name: str + :keyword db_port: Gets or sets the db2 database sql port. + :paramtype db_port: str + :keyword db_username: Gets or sets the db2 database user name. + :paramtype db_username: str + :keyword db_password: Gets or sets the db2 database password. + :paramtype db_password: str + :keyword db_password_uri: Gets or sets the key vault URI to secret with the database password. + :paramtype db_password_uri: str + :keyword sap_sid: Gets or sets the SAP System Identifier. + :paramtype sap_sid: str + """ + super(DB2ProviderInstanceProperties, self).__init__(**kwargs) + self.provider_type = 'Db2' # type: str + self.hostname = hostname + self.db_name = db_name + self.db_port = db_port + self.db_username = db_username + self.db_password = db_password + self.db_password_uri = db_password_uri + self.sap_sid = sap_sid + + +class DeployerVmPackages(msrest.serialization.Model): + """Defines the url and storage account ID where deployer VM packages are uploaded. + + :ivar url: The URL to the deployer VM packages file. + :vartype url: str + :ivar storage_account_id: The deployer VM packages storage account id. + :vartype storage_account_id: str + """ + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + storage_account_id: Optional[str] = None, + **kwargs + ): + """ + :keyword url: The URL to the deployer VM packages file. + :paramtype url: str + :keyword storage_account_id: The deployer VM packages storage account id. + :paramtype storage_account_id: str + """ + super(DeployerVmPackages, self).__init__(**kwargs) + self.url = url + self.storage_account_id = storage_account_id + + +class SAPConfiguration(msrest.serialization.Model): + """The SAP Configuration. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: DeploymentConfiguration, DeploymentWithOSConfiguration, DiscoveryConfiguration. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: Required. The configuration Type.Constant filled by server. Possible + values include: "Deployment", "Discovery", "DeploymentWithOSConfig". + :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType + """ + + _validation = { + 'configuration_type': {'required': True}, + } + + _attribute_map = { + 'configuration_type': {'key': 'configurationType', 'type': 'str'}, + } + + _subtype_map = { + 'configuration_type': {'Deployment': 'DeploymentConfiguration', 'DeploymentWithOSConfig': 'DeploymentWithOSConfiguration', 'Discovery': 'DiscoveryConfiguration'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SAPConfiguration, self).__init__(**kwargs) + self.configuration_type = None # type: Optional[str] + + +class DeploymentConfiguration(SAPConfiguration): + """Deployment Configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: Required. The configuration Type.Constant filled by server. Possible + values include: "Deployment", "Discovery", "DeploymentWithOSConfig". + :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType + :ivar app_location: The geo-location where the SAP system is to be created. + :vartype app_location: str + :ivar infrastructure_configuration: The infrastructure configuration. + :vartype infrastructure_configuration: ~azure.mgmt.workloads.models.InfrastructureConfiguration + :ivar software_configuration: The software configuration. + :vartype software_configuration: ~azure.mgmt.workloads.models.SoftwareConfiguration + """ + + _validation = { + 'configuration_type': {'required': True}, + } + + _attribute_map = { + 'configuration_type': {'key': 'configurationType', 'type': 'str'}, + 'app_location': {'key': 'appLocation', 'type': 'str'}, + 'infrastructure_configuration': {'key': 'infrastructureConfiguration', 'type': 'InfrastructureConfiguration'}, + 'software_configuration': {'key': 'softwareConfiguration', 'type': 'SoftwareConfiguration'}, + } + + def __init__( + self, + *, + app_location: Optional[str] = None, + infrastructure_configuration: Optional["InfrastructureConfiguration"] = None, + software_configuration: Optional["SoftwareConfiguration"] = None, + **kwargs + ): + """ + :keyword app_location: The geo-location where the SAP system is to be created. + :paramtype app_location: str + :keyword infrastructure_configuration: The infrastructure configuration. + :paramtype infrastructure_configuration: + ~azure.mgmt.workloads.models.InfrastructureConfiguration + :keyword software_configuration: The software configuration. + :paramtype software_configuration: ~azure.mgmt.workloads.models.SoftwareConfiguration + """ + super(DeploymentConfiguration, self).__init__(**kwargs) + self.configuration_type = 'Deployment' # type: str + self.app_location = app_location + self.infrastructure_configuration = infrastructure_configuration + self.software_configuration = software_configuration + + +class DeploymentWithOSConfiguration(SAPConfiguration): + """Deployment along with OS Configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar configuration_type: Required. The configuration Type.Constant filled by server. Possible + values include: "Deployment", "Discovery", "DeploymentWithOSConfig". + :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType + :ivar app_location: The geo-location where the SAP system is to be created. + :vartype app_location: str + :ivar infrastructure_configuration: The infrastructure configuration. + :vartype infrastructure_configuration: ~azure.mgmt.workloads.models.InfrastructureConfiguration + :ivar software_configuration: The software configuration. + :vartype software_configuration: ~azure.mgmt.workloads.models.SoftwareConfiguration + :ivar os_sap_configuration: The OS and SAP configuration. + :vartype os_sap_configuration: ~azure.mgmt.workloads.models.OsSapConfiguration + """ + + _validation = { + 'configuration_type': {'required': True}, + } + + _attribute_map = { + 'configuration_type': {'key': 'configurationType', 'type': 'str'}, + 'app_location': {'key': 'appLocation', 'type': 'str'}, + 'infrastructure_configuration': {'key': 'infrastructureConfiguration', 'type': 'InfrastructureConfiguration'}, + 'software_configuration': {'key': 'softwareConfiguration', 'type': 'SoftwareConfiguration'}, + 'os_sap_configuration': {'key': 'osSapConfiguration', 'type': 'OsSapConfiguration'}, + } + + def __init__( + self, + *, + app_location: Optional[str] = None, + infrastructure_configuration: Optional["InfrastructureConfiguration"] = None, + software_configuration: Optional["SoftwareConfiguration"] = None, + os_sap_configuration: Optional["OsSapConfiguration"] = None, + **kwargs + ): + """ + :keyword app_location: The geo-location where the SAP system is to be created. + :paramtype app_location: str + :keyword infrastructure_configuration: The infrastructure configuration. + :paramtype infrastructure_configuration: + ~azure.mgmt.workloads.models.InfrastructureConfiguration + :keyword software_configuration: The software configuration. + :paramtype software_configuration: ~azure.mgmt.workloads.models.SoftwareConfiguration + :keyword os_sap_configuration: The OS and SAP configuration. + :paramtype os_sap_configuration: ~azure.mgmt.workloads.models.OsSapConfiguration + """ + super(DeploymentWithOSConfiguration, self).__init__(**kwargs) + self.configuration_type = 'DeploymentWithOSConfig' # type: str + self.app_location = app_location + self.infrastructure_configuration = infrastructure_configuration + self.software_configuration = software_configuration + self.os_sap_configuration = os_sap_configuration + + +class DiscoveryConfiguration(SAPConfiguration): + """Discovery Details. + + 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 configuration_type: Required. The configuration Type.Constant filled by server. Possible + values include: "Deployment", "Discovery", "DeploymentWithOSConfig". + :vartype configuration_type: str or ~azure.mgmt.workloads.models.SAPConfigurationType + :ivar central_server_vm_id: The virtual machine ID of the Central Server. + :vartype central_server_vm_id: str + :ivar app_location: The geo-location where the SAP system exists. + :vartype app_location: str + """ + + _validation = { + 'configuration_type': {'required': True}, + 'app_location': {'readonly': True}, + } + + _attribute_map = { + 'configuration_type': {'key': 'configurationType', 'type': 'str'}, + 'central_server_vm_id': {'key': 'centralServerVmId', 'type': 'str'}, + 'app_location': {'key': 'appLocation', 'type': 'str'}, + } + + def __init__( + self, + *, + central_server_vm_id: Optional[str] = None, + **kwargs + ): + """ + :keyword central_server_vm_id: The virtual machine ID of the Central Server. + :paramtype central_server_vm_id: str + """ + super(DiscoveryConfiguration, self).__init__(**kwargs) + self.configuration_type = 'Discovery' # type: str + self.central_server_vm_id = central_server_vm_id + self.app_location = None + + +class DiskInfo(msrest.serialization.Model): + """Disk resource creation details. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: Required. Storage type. Possible values include: "Premium_LRS", + "Standard_LRS", "StandardSSD_LRS". + :vartype storage_type: str or ~azure.mgmt.workloads.models.DiskStorageType + :ivar size_in_gb: Disk size in GB. + :vartype size_in_gb: long + """ + + _validation = { + 'storage_type': {'required': True}, + } + + _attribute_map = { + 'storage_type': {'key': 'storageType', 'type': 'str'}, + 'size_in_gb': {'key': 'sizeInGB', 'type': 'long'}, + } + + def __init__( + self, + *, + storage_type: Union[str, "DiskStorageType"], + size_in_gb: Optional[int] = None, + **kwargs + ): + """ + :keyword storage_type: Required. Storage type. Possible values include: "Premium_LRS", + "Standard_LRS", "StandardSSD_LRS". + :paramtype storage_type: str or ~azure.mgmt.workloads.models.DiskStorageType + :keyword size_in_gb: Disk size in GB. + :paramtype size_in_gb: long + """ + super(DiskInfo, self).__init__(**kwargs) + self.storage_type = storage_type + self.size_in_gb = size_in_gb + + +class EnqueueReplicationServerProperties(msrest.serialization.Model): + """Defines the SAP ERS Server properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ers_version: Defines the type of Enqueue Replication Server. Possible values include: + "EnqueueReplicator1", "EnqueueReplicator2". + :vartype ers_version: str or ~azure.mgmt.workloads.models.EnqueueReplicationServerType + :ivar instance_no: The ERS server instance id. + :vartype instance_no: str + :ivar hostname: The ERS server SAP host name. + :vartype hostname: str + :ivar kernel_version: The ERS server SAP kernel version. + :vartype kernel_version: str + :ivar kernel_patch: The ERS server SAP kernel patch. + :vartype kernel_patch: str + :ivar ip_address: The ERS server SAP IP Address. + :vartype ip_address: str + :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + "Unhealthy", "Degraded". + :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState + """ + + _validation = { + 'ers_version': {'readonly': True}, + 'instance_no': {'readonly': True}, + 'hostname': {'readonly': True}, + 'kernel_version': {'readonly': True}, + 'kernel_patch': {'readonly': True}, + 'ip_address': {'readonly': True}, + 'health': {'readonly': True}, + } + + _attribute_map = { + 'ers_version': {'key': 'ersVersion', 'type': 'str'}, + 'instance_no': {'key': 'instanceNo', 'type': 'str'}, + 'hostname': {'key': 'hostname', 'type': 'str'}, + 'kernel_version': {'key': 'kernelVersion', 'type': 'str'}, + 'kernel_patch': {'key': 'kernelPatch', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'health': {'key': 'health', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(EnqueueReplicationServerProperties, self).__init__(**kwargs) + self.ers_version = None + self.instance_no = None + self.hostname = None + self.kernel_version = None + self.kernel_patch = None + self.ip_address = None + self.health = None + + +class EnqueueServerProperties(msrest.serialization.Model): + """Defines the SAP enqueue server properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hostname: The enqueue server SAP host name. + :vartype hostname: str + :ivar ip_address: The enqueue server SAP IP Address. + :vartype ip_address: str + :ivar port: The enqueue server Port. + :vartype port: long + :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + "Unhealthy", "Degraded". + :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState + """ + + _validation = { + 'hostname': {'readonly': True}, + 'ip_address': {'readonly': True}, + 'port': {'readonly': True}, + 'health': {'readonly': True}, + } + + _attribute_map = { + 'hostname': {'key': 'hostname', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'long'}, + 'health': {'key': 'health', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(EnqueueServerProperties, self).__init__(**kwargs) + self.hostname = None + self.ip_address = None + self.port = None + self.health = None + + +class Error(msrest.serialization.Model): + """Standard error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Server-defined set of error codes. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar target: Target of the error. + :vartype target: str + :ivar details: Array of details about specific errors that led to this reported error. + :vartype details: list[~azure.mgmt.workloads.models.Error] + :ivar inner_error: Object containing more specific information than the current object about + the error. + :vartype inner_error: ~azure.mgmt.workloads.models.ErrorInnerError + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'ErrorInnerError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.inner_error = None + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = 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: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.workloads.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + 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 error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.workloads.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.workloads.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorInnerError(msrest.serialization.Model): + """Object containing more specific information than the current object about the error. + + :ivar inner_error: Standard error object. + :vartype inner_error: ~azure.mgmt.workloads.models.Error + """ + + _attribute_map = { + 'inner_error': {'key': 'innerError', 'type': 'Error'}, + } + + def __init__( + self, + *, + inner_error: Optional["Error"] = None, + **kwargs + ): + """ + :keyword inner_error: Standard error object. + :paramtype inner_error: ~azure.mgmt.workloads.models.Error + """ + super(ErrorInnerError, self).__init__(**kwargs) + self.inner_error = inner_error + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.workloads.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.workloads.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class FileshareProfile(msrest.serialization.Model): + """File share profile. + + 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 share_type: Required. Share type. Possible values include: "NfsOnController", + "AzureFiles". + :vartype share_type: str or ~azure.mgmt.workloads.models.FileShareType + :ivar storage_type: Required. File share backing storage type. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_ZRS", "Premium_LRS". + :vartype storage_type: str or ~azure.mgmt.workloads.models.FileShareStorageType + :ivar share_size_in_gb: File share size in GB. + :vartype share_size_in_gb: long + :ivar storage_resource_id: File share storage resource id. + :vartype storage_resource_id: str + :ivar share_name: File share name. + :vartype share_name: str + """ + + _validation = { + 'share_type': {'required': True}, + 'storage_type': {'required': True}, + 'share_size_in_gb': {'minimum': 1}, + 'storage_resource_id': {'readonly': True}, + 'share_name': {'readonly': True}, + } + + _attribute_map = { + 'share_type': {'key': 'shareType', 'type': 'str'}, + 'storage_type': {'key': 'storageType', 'type': 'str'}, + 'share_size_in_gb': {'key': 'shareSizeInGB', 'type': 'long'}, + 'storage_resource_id': {'key': 'storageResourceId', 'type': 'str'}, + 'share_name': {'key': 'shareName', 'type': 'str'}, + } + + def __init__( + self, + *, + share_type: Union[str, "FileShareType"], + storage_type: Union[str, "FileShareStorageType"], + share_size_in_gb: Optional[int] = None, + **kwargs + ): + """ + :keyword share_type: Required. Share type. Possible values include: "NfsOnController", + "AzureFiles". + :paramtype share_type: str or ~azure.mgmt.workloads.models.FileShareType + :keyword storage_type: Required. File share backing storage type. Possible values include: + "Standard_LRS", "Standard_GRS", "Standard_ZRS", "Premium_LRS". + :paramtype storage_type: str or ~azure.mgmt.workloads.models.FileShareStorageType + :keyword share_size_in_gb: File share size in GB. + :paramtype share_size_in_gb: long + """ + super(FileshareProfile, self).__init__(**kwargs) + self.share_type = share_type + self.storage_type = storage_type + self.share_size_in_gb = share_size_in_gb + self.storage_resource_id = None + self.share_name = None + + +class GatewayServerProperties(msrest.serialization.Model): + """Defines the SAP Gateway Server properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar port: The gateway Port. + :vartype port: long + :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + "Unhealthy", "Degraded". + :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState + """ + + _validation = { + 'port': {'readonly': True}, + 'health': {'readonly': True}, + } + + _attribute_map = { + 'port': {'key': 'port', 'type': 'long'}, + 'health': {'key': 'health', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GatewayServerProperties, self).__init__(**kwargs) + self.port = None + self.health = None + + +class HanaDbProviderInstanceProperties(ProviderSpecificProperties): + """Gets or sets the provider properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_type: Required. The provider type. For example, the value can be + SapHana.Constant filled by server. + :vartype provider_type: str + :ivar hostname: Gets or sets the target virtual machine size. + :vartype hostname: str + :ivar db_name: Gets or sets the hana database name. + :vartype db_name: str + :ivar sql_port: Gets or sets the database sql port. + :vartype sql_port: str + :ivar instance_number: Gets or sets the database instance number. + :vartype instance_number: str + :ivar db_username: Gets or sets the database user name. + :vartype db_username: str + :ivar db_password: Gets or sets the database password. + :vartype db_password: str + :ivar db_password_uri: Gets or sets the key vault URI to secret with the database password. + :vartype db_password_uri: str + :ivar db_ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the DB. + :vartype db_ssl_certificate_uri: str + :ivar ssl_host_name_in_certificate: Gets or sets the hostname(s) in the SSL certificate. + :vartype ssl_host_name_in_certificate: str + """ + + _validation = { + 'provider_type': {'required': True}, + } + + _attribute_map = { + 'provider_type': {'key': 'providerType', 'type': 'str'}, + 'hostname': {'key': 'hostname', 'type': 'str'}, + 'db_name': {'key': 'dbName', 'type': 'str'}, + 'sql_port': {'key': 'sqlPort', 'type': 'str'}, + 'instance_number': {'key': 'instanceNumber', 'type': 'str'}, + 'db_username': {'key': 'dbUsername', 'type': 'str'}, + 'db_password': {'key': 'dbPassword', 'type': 'str'}, + 'db_password_uri': {'key': 'dbPasswordUri', 'type': 'str'}, + 'db_ssl_certificate_uri': {'key': 'dbSslCertificateUri', 'type': 'str'}, + 'ssl_host_name_in_certificate': {'key': 'sslHostNameInCertificate', 'type': 'str'}, + } + + def __init__( + self, + *, + hostname: Optional[str] = None, + db_name: Optional[str] = None, + sql_port: Optional[str] = None, + instance_number: Optional[str] = None, + db_username: Optional[str] = None, + db_password: Optional[str] = None, + db_password_uri: Optional[str] = None, + db_ssl_certificate_uri: Optional[str] = None, + ssl_host_name_in_certificate: Optional[str] = None, + **kwargs + ): + """ + :keyword hostname: Gets or sets the target virtual machine size. + :paramtype hostname: str + :keyword db_name: Gets or sets the hana database name. + :paramtype db_name: str + :keyword sql_port: Gets or sets the database sql port. + :paramtype sql_port: str + :keyword instance_number: Gets or sets the database instance number. + :paramtype instance_number: str + :keyword db_username: Gets or sets the database user name. + :paramtype db_username: str + :keyword db_password: Gets or sets the database password. + :paramtype db_password: str + :keyword db_password_uri: Gets or sets the key vault URI to secret with the database password. + :paramtype db_password_uri: str + :keyword db_ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the DB. + :paramtype db_ssl_certificate_uri: str + :keyword ssl_host_name_in_certificate: Gets or sets the hostname(s) in the SSL certificate. + :paramtype ssl_host_name_in_certificate: str + """ + super(HanaDbProviderInstanceProperties, self).__init__(**kwargs) + self.provider_type = 'SapHana' # type: str + self.hostname = hostname + self.db_name = db_name + self.sql_port = sql_port + self.instance_number = instance_number + self.db_username = db_username + self.db_password = db_password + self.db_password_uri = db_password_uri + self.db_ssl_certificate_uri = db_ssl_certificate_uri + self.ssl_host_name_in_certificate = ssl_host_name_in_certificate + + +class HighAvailabilityConfiguration(msrest.serialization.Model): + """Gets or sets the high availability configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar high_availability_type: Required. The high availability type. Possible values include: + "AvailabilitySet", "AvailabilityZone". + :vartype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType + """ + + _validation = { + 'high_availability_type': {'required': True}, + } + + _attribute_map = { + 'high_availability_type': {'key': 'highAvailabilityType', 'type': 'str'}, + } + + def __init__( + self, + *, + high_availability_type: Union[str, "SAPHighAvailabilityType"], + **kwargs + ): + """ + :keyword high_availability_type: Required. The high availability type. Possible values include: + "AvailabilitySet", "AvailabilityZone". + :paramtype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType + """ + super(HighAvailabilityConfiguration, self).__init__(**kwargs) + self.high_availability_type = high_availability_type + + +class HighAvailabilitySoftwareConfiguration(msrest.serialization.Model): + """Gets or sets the HA software configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar fencing_client_id: Required. The fencing client id. + :vartype fencing_client_id: str + :ivar fencing_client_password: Required. The fencing client id secret/password. The secret + should never expire. This will be used pacemaker to start/stop the cluster VMs. + :vartype fencing_client_password: str + """ + + _validation = { + 'fencing_client_id': {'required': True}, + 'fencing_client_password': {'required': True}, + } + + _attribute_map = { + 'fencing_client_id': {'key': 'fencingClientId', 'type': 'str'}, + 'fencing_client_password': {'key': 'fencingClientPassword', 'type': 'str'}, + } + + def __init__( + self, + *, + fencing_client_id: str, + fencing_client_password: str, + **kwargs + ): + """ + :keyword fencing_client_id: Required. The fencing client id. + :paramtype fencing_client_id: str + :keyword fencing_client_password: Required. The fencing client id secret/password. The secret + should never expire. This will be used pacemaker to start/stop the cluster VMs. + :paramtype fencing_client_password: str + """ + super(HighAvailabilitySoftwareConfiguration, self).__init__(**kwargs) + self.fencing_client_id = fencing_client_id + self.fencing_client_password = fencing_client_password + + +class ImageReference(msrest.serialization.Model): + """Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar publisher: The image publisher. + :vartype publisher: str + :ivar offer: Specifies the offer of the platform image or marketplace image used to create the + virtual machine. + :vartype offer: str + :ivar sku: The image SKU. + :vartype sku: str + :ivar version: Specifies the version of the platform image or marketplace image used to create + the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and + Build are decimal numbers. Specify 'latest' to use the latest version of an image available at + deploy time. Even if you use 'latest', the VM image will not automatically update after deploy + time even if a new version becomes available. + :vartype version: str + :ivar exact_version: Specifies in decimal numbers, the version of platform image or marketplace + image used to create the virtual machine. This readonly field differs from 'version', only if + the value specified in 'version' field is 'latest'. + :vartype exact_version: str + :ivar shared_gallery_image_id: Specified the shared gallery image unique id for vm deployment. + This can be fetched from shared gallery image GET call. + :vartype shared_gallery_image_id: str + """ + + _validation = { + 'exact_version': {'readonly': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'exact_version': {'key': 'exactVersion', 'type': 'str'}, + 'shared_gallery_image_id': {'key': 'sharedGalleryImageId', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + offer: Optional[str] = None, + sku: Optional[str] = None, + version: Optional[str] = None, + shared_gallery_image_id: Optional[str] = None, + **kwargs + ): + """ + :keyword publisher: The image publisher. + :paramtype publisher: str + :keyword offer: Specifies the offer of the platform image or marketplace image used to create + the virtual machine. + :paramtype offer: str + :keyword sku: The image SKU. + :paramtype sku: str + :keyword version: Specifies the version of the platform image or marketplace image used to + create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, + Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image + available at deploy time. Even if you use 'latest', the VM image will not automatically update + after deploy time even if a new version becomes available. + :paramtype version: str + :keyword shared_gallery_image_id: Specified the shared gallery image unique id for vm + deployment. This can be fetched from shared gallery image GET call. + :paramtype shared_gallery_image_id: str + """ + super(ImageReference, self).__init__(**kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + self.version = version + self.exact_version = None + self.shared_gallery_image_id = shared_gallery_image_id + + +class InfrastructureConfiguration(msrest.serialization.Model): + """Deploy SAP Infrastructure Details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SingleServerConfiguration, ThreeTierConfiguration. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values + include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar app_resource_group: Required. The application resource group where SAP system resources + will be deployed. + :vartype app_resource_group: str + """ + + _validation = { + 'deployment_type': {'required': True}, + 'app_resource_group': {'required': True}, + } + + _attribute_map = { + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'app_resource_group': {'key': 'appResourceGroup', 'type': 'str'}, + } + + _subtype_map = { + 'deployment_type': {'SingleServer': 'SingleServerConfiguration', 'ThreeTier': 'ThreeTierConfiguration'} + } + + def __init__( + self, + *, + app_resource_group: str, + **kwargs + ): + """ + :keyword app_resource_group: Required. The application resource group where SAP system + resources will be deployed. + :paramtype app_resource_group: str + """ + super(InfrastructureConfiguration, self).__init__(**kwargs) + self.deployment_type = None # type: Optional[str] + self.app_resource_group = app_resource_group + + +class OSConfiguration(msrest.serialization.Model): + """Defines the OS configuration. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: LinuxConfiguration, WindowsConfiguration. + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: Required. The OS Type.Constant filled by server. Possible values include: + "Linux", "Windows". + :vartype os_type: str or ~azure.mgmt.workloads.models.OSType + """ + + _validation = { + 'os_type': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + } + + _subtype_map = { + 'os_type': {'Linux': 'LinuxConfiguration', 'Windows': 'WindowsConfiguration'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OSConfiguration, self).__init__(**kwargs) + self.os_type = None # type: Optional[str] + + +class LinuxConfiguration(OSConfiguration): + """Specifies the Linux operating system settings on the virtual machine. :code:`
`:code:`
`For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions `_. + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: Required. The OS Type.Constant filled by server. Possible values include: + "Linux", "Windows". + :vartype os_type: str or ~azure.mgmt.workloads.models.OSType + :ivar disable_password_authentication: Specifies whether password authentication should be + disabled. + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. (This property is deprecated, + please use 'sshKeyPair' instead). + :vartype ssh: ~azure.mgmt.workloads.models.SshConfiguration + :ivar ssh_key_pair: The SSH Key-pair used to authenticate with the VM's. + :vartype ssh_key_pair: ~azure.mgmt.workloads.models.SshKeyPair + """ + + _validation = { + 'os_type': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, + 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, + 'ssh_key_pair': {'key': 'sshKeyPair', 'type': 'SshKeyPair'}, + } + + def __init__( + self, + *, + disable_password_authentication: Optional[bool] = None, + ssh: Optional["SshConfiguration"] = None, + ssh_key_pair: Optional["SshKeyPair"] = None, + **kwargs + ): + """ + :keyword disable_password_authentication: Specifies whether password authentication should be + disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: Specifies the ssh key configuration for a Linux OS. (This property is deprecated, + please use 'sshKeyPair' instead). + :paramtype ssh: ~azure.mgmt.workloads.models.SshConfiguration + :keyword ssh_key_pair: The SSH Key-pair used to authenticate with the VM's. + :paramtype ssh_key_pair: ~azure.mgmt.workloads.models.SshKeyPair + """ + super(LinuxConfiguration, self).__init__(**kwargs) + self.os_type = 'Linux' # type: str + self.disable_password_authentication = disable_password_authentication + self.ssh = ssh + self.ssh_key_pair = ssh_key_pair + + +class ManagedRGConfiguration(msrest.serialization.Model): + """Managed resource group configuration. + + :ivar name: Managed resource group name. + :vartype name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Managed resource group name. + :paramtype name: str + """ + super(ManagedRGConfiguration, self).__init__(**kwargs) + self.name = name + + +class MessageServerProperties(msrest.serialization.Model): + """Defines the SAP message server properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ms_port: The message server port. + :vartype ms_port: long + :ivar internal_ms_port: The message server internal MS port. + :vartype internal_ms_port: long + :ivar http_port: The message server http port. + :vartype http_port: long + :ivar https_port: The message server https port. + :vartype https_port: long + :ivar hostname: The message server SAP host name. + :vartype hostname: str + :ivar ip_address: The message server IP Address. + :vartype ip_address: str + :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + "Unhealthy", "Degraded". + :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState + """ + + _validation = { + 'ms_port': {'readonly': True}, + 'internal_ms_port': {'readonly': True}, + 'http_port': {'readonly': True}, + 'https_port': {'readonly': True}, + 'hostname': {'readonly': True}, + 'ip_address': {'readonly': True}, + 'health': {'readonly': True}, + } + + _attribute_map = { + 'ms_port': {'key': 'msPort', 'type': 'long'}, + 'internal_ms_port': {'key': 'internalMsPort', 'type': 'long'}, + 'http_port': {'key': 'httpPort', 'type': 'long'}, + 'https_port': {'key': 'httpsPort', 'type': 'long'}, + 'hostname': {'key': 'hostname', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'health': {'key': 'health', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(MessageServerProperties, self).__init__(**kwargs) + self.ms_port = None + self.internal_ms_port = None + self.http_port = None + self.https_port = None + self.hostname = None + self.ip_address = None + self.health = None + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Monitor(TrackedResource): + """SAP monitor info on Azure (ARM properties and SAP monitor properties). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Managed service identity (user assigned identities). + :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + :ivar provisioning_state: State of provisioning of the SAP monitor. Possible values include: + "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.models.WorkloadMonitorProvisioningState + :ivar errors: Defines the SAP monitor errors. + :vartype errors: ~azure.mgmt.workloads.models.MonitorPropertiesErrors + :ivar app_location: The SAP monitor resources will be deployed in the SAP monitoring region. + The subnet region should be same as the SAP monitoring region. + :vartype app_location: str + :ivar routing_preference: Sets the routing preference of the SAP monitor. By default only + RFC1918 traffic is routed to the customer VNET. Possible values include: "Default", "RouteAll". + :vartype routing_preference: str or ~azure.mgmt.workloads.models.RoutingPreference + :ivar managed_resource_group_configuration: Managed resource group configuration. + :vartype managed_resource_group_configuration: + ~azure.mgmt.workloads.models.ManagedRGConfiguration + :ivar log_analytics_workspace_arm_id: The ARM ID of the Log Analytics Workspace that is used + for SAP monitoring. + :vartype log_analytics_workspace_arm_id: str + :ivar monitor_subnet: The subnet which the SAP monitor will be deployed in. + :vartype monitor_subnet: str + :ivar msi_arm_id: The ARM ID of the MSI used for SAP monitoring. + :vartype msi_arm_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'errors': {'readonly': True}, + 'msi_arm_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'errors': {'key': 'properties.errors', 'type': 'MonitorPropertiesErrors'}, + 'app_location': {'key': 'properties.appLocation', 'type': 'str'}, + 'routing_preference': {'key': 'properties.routingPreference', 'type': 'str'}, + 'managed_resource_group_configuration': {'key': 'properties.managedResourceGroupConfiguration', 'type': 'ManagedRGConfiguration'}, + 'log_analytics_workspace_arm_id': {'key': 'properties.logAnalyticsWorkspaceArmId', 'type': 'str'}, + 'monitor_subnet': {'key': 'properties.monitorSubnet', 'type': 'str'}, + 'msi_arm_id': {'key': 'properties.msiArmId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["UserAssignedServiceIdentity"] = None, + app_location: Optional[str] = None, + routing_preference: Optional[Union[str, "RoutingPreference"]] = None, + managed_resource_group_configuration: Optional["ManagedRGConfiguration"] = None, + log_analytics_workspace_arm_id: Optional[str] = None, + monitor_subnet: Optional[str] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Managed service identity (user assigned identities). + :paramtype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + :keyword app_location: The SAP monitor resources will be deployed in the SAP monitoring region. + The subnet region should be same as the SAP monitoring region. + :paramtype app_location: str + :keyword routing_preference: Sets the routing preference of the SAP monitor. By default only + RFC1918 traffic is routed to the customer VNET. Possible values include: "Default", "RouteAll". + :paramtype routing_preference: str or ~azure.mgmt.workloads.models.RoutingPreference + :keyword managed_resource_group_configuration: Managed resource group configuration. + :paramtype managed_resource_group_configuration: + ~azure.mgmt.workloads.models.ManagedRGConfiguration + :keyword log_analytics_workspace_arm_id: The ARM ID of the Log Analytics Workspace that is used + for SAP monitoring. + :paramtype log_analytics_workspace_arm_id: str + :keyword monitor_subnet: The subnet which the SAP monitor will be deployed in. + :paramtype monitor_subnet: str + """ + super(Monitor, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.provisioning_state = None + self.errors = None + self.app_location = app_location + self.routing_preference = routing_preference + self.managed_resource_group_configuration = managed_resource_group_configuration + self.log_analytics_workspace_arm_id = log_analytics_workspace_arm_id + self.monitor_subnet = monitor_subnet + self.msi_arm_id = None + + +class MonitorListResult(msrest.serialization.Model): + """The response from the List SAP monitors operation. + + :ivar value: The list of SAP monitors. + :vartype value: list[~azure.mgmt.workloads.models.Monitor] + :ivar next_link: The URL to get the next set of SAP monitors. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Monitor]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Monitor"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of SAP monitors. + :paramtype value: list[~azure.mgmt.workloads.models.Monitor] + :keyword next_link: The URL to get the next set of SAP monitors. + :paramtype next_link: str + """ + super(MonitorListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MonitorPropertiesErrors(Error): + """Defines the SAP monitor errors. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Server-defined set of error codes. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar target: Target of the error. + :vartype target: str + :ivar details: Array of details about specific errors that led to this reported error. + :vartype details: list[~azure.mgmt.workloads.models.Error] + :ivar inner_error: Object containing more specific information than the current object about + the error. + :vartype inner_error: ~azure.mgmt.workloads.models.ErrorInnerError + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'ErrorInnerError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(MonitorPropertiesErrors, self).__init__(**kwargs) + + +class MsSqlServerProviderInstanceProperties(ProviderSpecificProperties): + """Gets or sets the SQL server provider properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_type: Required. The provider type. For example, the value can be + SapHana.Constant filled by server. + :vartype provider_type: str + :ivar hostname: Gets or sets the SQL server host name. + :vartype hostname: str + :ivar db_port: Gets or sets the database sql port. + :vartype db_port: str + :ivar db_username: Gets or sets the database user name. + :vartype db_username: str + :ivar db_password: Gets or sets the database password. + :vartype db_password: str + :ivar db_password_uri: Gets or sets the key vault URI to secret with the database password. + :vartype db_password_uri: str + :ivar sap_sid: Gets or sets the SAP System Identifier. + :vartype sap_sid: str + """ + + _validation = { + 'provider_type': {'required': True}, + } + + _attribute_map = { + 'provider_type': {'key': 'providerType', 'type': 'str'}, + 'hostname': {'key': 'hostname', 'type': 'str'}, + 'db_port': {'key': 'dbPort', 'type': 'str'}, + 'db_username': {'key': 'dbUsername', 'type': 'str'}, + 'db_password': {'key': 'dbPassword', 'type': 'str'}, + 'db_password_uri': {'key': 'dbPasswordUri', 'type': 'str'}, + 'sap_sid': {'key': 'sapSid', 'type': 'str'}, + } + + def __init__( + self, + *, + hostname: Optional[str] = None, + db_port: Optional[str] = None, + db_username: Optional[str] = None, + db_password: Optional[str] = None, + db_password_uri: Optional[str] = None, + sap_sid: Optional[str] = None, + **kwargs + ): + """ + :keyword hostname: Gets or sets the SQL server host name. + :paramtype hostname: str + :keyword db_port: Gets or sets the database sql port. + :paramtype db_port: str + :keyword db_username: Gets or sets the database user name. + :paramtype db_username: str + :keyword db_password: Gets or sets the database password. + :paramtype db_password: str + :keyword db_password_uri: Gets or sets the key vault URI to secret with the database password. + :paramtype db_password_uri: str + :keyword sap_sid: Gets or sets the SAP System Identifier. + :paramtype sap_sid: str + """ + super(MsSqlServerProviderInstanceProperties, self).__init__(**kwargs) + self.provider_type = 'MsSqlServer' # type: str + self.hostname = hostname + self.db_port = db_port + self.db_username = db_username + self.db_password = db_password + self.db_password_uri = db_password_uri + self.sap_sid = sap_sid + + +class NetworkConfiguration(msrest.serialization.Model): + """Defines the network configuration for SAP infrastructure. + + :ivar is_secondary_ip_enabled: Specifies whether a secondary IP address should be added to the + network interface on all VMs. + :vartype is_secondary_ip_enabled: bool + """ + + _attribute_map = { + 'is_secondary_ip_enabled': {'key': 'isSecondaryIpEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + is_secondary_ip_enabled: Optional[bool] = False, + **kwargs + ): + """ + :keyword is_secondary_ip_enabled: Specifies whether a secondary IP address should be added to + the network interface on all VMs. + :paramtype is_secondary_ip_enabled: bool + """ + super(NetworkConfiguration, self).__init__(**kwargs) + self.is_secondary_ip_enabled = is_secondary_ip_enabled + + +class NetworkProfile(msrest.serialization.Model): + """Network profile. + + 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 load_balancer_type: Required. Load balancer type. Possible values include: + "ApplicationGateway", "LoadBalancer". + :vartype load_balancer_type: str or ~azure.mgmt.workloads.models.LoadBalancerType + :ivar load_balancer_sku: Load balancer SKU. + :vartype load_balancer_sku: str + :ivar load_balancer_tier: Load balancer tier. + :vartype load_balancer_tier: str + :ivar capacity: Capacity, applicable only for Application Gateway. + :vartype capacity: int + :ivar azure_front_door_enabled: Whether to enable Azure front door. Possible values include: + "Enabled", "Disabled". + :vartype azure_front_door_enabled: str or ~azure.mgmt.workloads.models.AzureFrontDoorEnabled + :ivar v_net_resource_id: Virtual network resource Id. + :vartype v_net_resource_id: str + :ivar load_balancer_resource_id: Azure Loadbalancer or ApplicationGateway resource Id. + :vartype load_balancer_resource_id: str + :ivar azure_front_door_resource_id: Azure front door resource id. + :vartype azure_front_door_resource_id: str + :ivar front_end_public_ip_resource_id: Loadbalancer front-end IP address resource Id. + :vartype front_end_public_ip_resource_id: str + :ivar outbound_public_ip_resource_ids: List of outbound public IP resource IDs. + :vartype outbound_public_ip_resource_ids: list[str] + """ + + _validation = { + 'load_balancer_type': {'required': True}, + 'v_net_resource_id': {'readonly': True}, + 'load_balancer_resource_id': {'readonly': True}, + 'azure_front_door_resource_id': {'readonly': True}, + 'front_end_public_ip_resource_id': {'readonly': True}, + 'outbound_public_ip_resource_ids': {'readonly': True}, + } + + _attribute_map = { + 'load_balancer_type': {'key': 'loadBalancerType', 'type': 'str'}, + 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + 'load_balancer_tier': {'key': 'loadBalancerTier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'azure_front_door_enabled': {'key': 'azureFrontDoorEnabled', 'type': 'str'}, + 'v_net_resource_id': {'key': 'vNetResourceId', 'type': 'str'}, + 'load_balancer_resource_id': {'key': 'loadBalancerResourceId', 'type': 'str'}, + 'azure_front_door_resource_id': {'key': 'azureFrontDoorResourceId', 'type': 'str'}, + 'front_end_public_ip_resource_id': {'key': 'frontEndPublicIpResourceId', 'type': 'str'}, + 'outbound_public_ip_resource_ids': {'key': 'outboundPublicIpResourceIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + load_balancer_type: Union[str, "LoadBalancerType"], + load_balancer_sku: Optional[str] = None, + load_balancer_tier: Optional[str] = None, + capacity: Optional[int] = None, + azure_front_door_enabled: Optional[Union[str, "AzureFrontDoorEnabled"]] = None, + **kwargs + ): + """ + :keyword load_balancer_type: Required. Load balancer type. Possible values include: + "ApplicationGateway", "LoadBalancer". + :paramtype load_balancer_type: str or ~azure.mgmt.workloads.models.LoadBalancerType + :keyword load_balancer_sku: Load balancer SKU. + :paramtype load_balancer_sku: str + :keyword load_balancer_tier: Load balancer tier. + :paramtype load_balancer_tier: str + :keyword capacity: Capacity, applicable only for Application Gateway. + :paramtype capacity: int + :keyword azure_front_door_enabled: Whether to enable Azure front door. Possible values include: + "Enabled", "Disabled". + :paramtype azure_front_door_enabled: str or ~azure.mgmt.workloads.models.AzureFrontDoorEnabled + """ + super(NetworkProfile, self).__init__(**kwargs) + self.load_balancer_type = load_balancer_type + self.load_balancer_sku = load_balancer_sku + self.load_balancer_tier = load_balancer_tier + self.capacity = capacity + self.azure_front_door_enabled = azure_front_door_enabled + self.v_net_resource_id = None + self.load_balancer_resource_id = None + self.azure_front_door_resource_id = None + self.front_end_public_ip_resource_id = None + self.outbound_public_ip_resource_ids = None + + +class NodeProfile(msrest.serialization.Model): + """VM or VMSS node profile. + + 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 name: VM or VMSS name. + :vartype name: str + :ivar node_sku: Required. VM SKU for node(s). + :vartype node_sku: str + :ivar os_image: Required. OS image used for creating the nodes. + :vartype os_image: ~azure.mgmt.workloads.models.OsImageProfile + :ivar os_disk: Required. OS disk details. + :vartype os_disk: ~azure.mgmt.workloads.models.DiskInfo + :ivar data_disks: Data disks details. This property is not in use right now. + :vartype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] + :ivar node_resource_ids: VM/VMSS resource ARM Ids. + :vartype node_resource_ids: list[str] + """ + + _validation = { + 'node_sku': {'required': True}, + 'os_image': {'required': True}, + 'os_disk': {'required': True}, + 'node_resource_ids': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'node_sku': {'key': 'nodeSku', 'type': 'str'}, + 'os_image': {'key': 'osImage', 'type': 'OsImageProfile'}, + 'os_disk': {'key': 'osDisk', 'type': 'DiskInfo'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DiskInfo]'}, + 'node_resource_ids': {'key': 'nodeResourceIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + node_sku: str, + os_image: "OsImageProfile", + os_disk: "DiskInfo", + name: Optional[str] = None, + data_disks: Optional[List["DiskInfo"]] = None, + **kwargs + ): + """ + :keyword name: VM or VMSS name. + :paramtype name: str + :keyword node_sku: Required. VM SKU for node(s). + :paramtype node_sku: str + :keyword os_image: Required. OS image used for creating the nodes. + :paramtype os_image: ~azure.mgmt.workloads.models.OsImageProfile + :keyword os_disk: Required. OS disk details. + :paramtype os_disk: ~azure.mgmt.workloads.models.DiskInfo + :keyword data_disks: Data disks details. This property is not in use right now. + :paramtype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] + """ + super(NodeProfile, self).__init__(**kwargs) + self.name = name + self.node_sku = node_sku + self.os_image = os_image + self.os_disk = os_disk + self.data_disks = data_disks + self.node_resource_ids = None + + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.workloads.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.workloads.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.workloads.models.ActionType + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.workloads.models.OperationDisplay + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.workloads.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + '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 = None + self.next_link = None + + +class OperationsContent(Resource): + """Defines the workload operation content. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar name_properties_name: Name of the operation. + :vartype name_properties_name: str + :ivar is_data_action: Indicates whether the operation applies to data-plane. + :vartype is_data_action: bool + :ivar origin: Defines the workload operation origin. Possible values include: "NotSpecified", + "User", "System". + :vartype origin: str or ~azure.mgmt.workloads.models.OperationProperties + :ivar display: Display information of the operation. + :vartype display: ~azure.mgmt.workloads.models.OperationsDefinitionDisplay + :ivar action_type: Defines the action type of workload operation. Possible values include: + "NotSpecified", "Internal". + :vartype action_type: str or ~azure.mgmt.workloads.models.WorkloadMonitorActionType + :ivar properties: Defines the workload operation properties. + :vartype properties: any + """ + + _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'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, + 'is_data_action': {'key': 'properties.isDataAction', 'type': 'bool'}, + 'origin': {'key': 'properties.origin', 'type': 'str'}, + 'display': {'key': 'properties.display', 'type': 'OperationsDefinitionDisplay'}, + 'action_type': {'key': 'properties.actionType', 'type': 'str'}, + 'properties': {'key': 'properties.properties', 'type': 'object'}, + } + + def __init__( + self, + *, + name_properties_name: Optional[str] = None, + is_data_action: Optional[bool] = None, + origin: Optional[Union[str, "OperationProperties"]] = None, + display: Optional["OperationsDefinitionDisplay"] = None, + action_type: Optional[Union[str, "WorkloadMonitorActionType"]] = None, + properties: Optional[Any] = None, + **kwargs + ): + """ + :keyword name_properties_name: Name of the operation. + :paramtype name_properties_name: str + :keyword is_data_action: Indicates whether the operation applies to data-plane. + :paramtype is_data_action: bool + :keyword origin: Defines the workload operation origin. Possible values include: + "NotSpecified", "User", "System". + :paramtype origin: str or ~azure.mgmt.workloads.models.OperationProperties + :keyword display: Display information of the operation. + :paramtype display: ~azure.mgmt.workloads.models.OperationsDefinitionDisplay + :keyword action_type: Defines the action type of workload operation. Possible values include: + "NotSpecified", "Internal". + :paramtype action_type: str or ~azure.mgmt.workloads.models.WorkloadMonitorActionType + :keyword properties: Defines the workload operation properties. + :paramtype properties: any + """ + super(OperationsContent, self).__init__(**kwargs) + self.name_properties_name = name_properties_name + self.is_data_action = is_data_action + self.origin = origin + self.display = display + self.action_type = action_type + self.properties = properties + + +class OperationsDefinition(msrest.serialization.Model): + """Properties of an Operation. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation applies to data-plane. + :vartype is_data_action: bool + :ivar origin: Defines the workload operation origin. Possible values include: "NotSpecified", + "User", "System". + :vartype origin: str or ~azure.mgmt.workloads.models.OperationProperties + :ivar display: Required. Display information of the operation. + :vartype display: ~azure.mgmt.workloads.models.OperationsDefinitionDisplay + :ivar action_type: Defines the action type of workload operation. Possible values include: + "NotSpecified", "Internal". + :vartype action_type: str or ~azure.mgmt.workloads.models.WorkloadMonitorActionType + :ivar properties: Defines the workload operation properties. + :vartype properties: any + """ + + _validation = { + 'name': {'required': True}, + 'display': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationsDefinitionDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + *, + name: str, + display: "OperationsDefinitionDisplay", + is_data_action: Optional[bool] = None, + origin: Optional[Union[str, "OperationProperties"]] = None, + action_type: Optional[Union[str, "WorkloadMonitorActionType"]] = None, + properties: Optional[Any] = None, + **kwargs + ): + """ + :keyword name: Required. Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation applies to data-plane. + :paramtype is_data_action: bool + :keyword origin: Defines the workload operation origin. Possible values include: + "NotSpecified", "User", "System". + :paramtype origin: str or ~azure.mgmt.workloads.models.OperationProperties + :keyword display: Required. Display information of the operation. + :paramtype display: ~azure.mgmt.workloads.models.OperationsDefinitionDisplay + :keyword action_type: Defines the action type of workload operation. Possible values include: + "NotSpecified", "Internal". + :paramtype action_type: str or ~azure.mgmt.workloads.models.WorkloadMonitorActionType + :keyword properties: Defines the workload operation properties. + :paramtype properties: any + """ + super(OperationsDefinition, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.origin = origin + self.display = display + self.action_type = action_type + self.properties = properties + + +class OperationsDefinitionArrayResponseWithContinuation(msrest.serialization.Model): + """Defines the workload operation definition response. + + :ivar value: Defines the workload operation definition response properties. + :vartype value: list[~azure.mgmt.workloads.models.OperationsDefinition] + :ivar next_link: The URL to get to the next set of results, if there are any. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationsDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationsDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Defines the workload operation definition response properties. + :paramtype value: list[~azure.mgmt.workloads.models.OperationsDefinition] + :keyword next_link: The URL to get to the next set of results, if there are any. + :paramtype next_link: str + """ + super(OperationsDefinitionArrayResponseWithContinuation, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationsDisplayDefinition(msrest.serialization.Model): + """Defines the workload operation. + + All required parameters must be populated in order to send to Azure. + + :ivar provider: Required. Defines the workload provider. + :vartype provider: str + :ivar resource: Required. Defines the workload resource. + :vartype resource: str + :ivar operation: Required. Defines the workload operation. + :vartype operation: str + :ivar description: Required. Describes the workload operation. + :vartype description: str + """ + + _validation = { + 'provider': {'required': True}, + 'resource': {'required': True}, + 'operation': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: str, + resource: str, + operation: str, + description: str, + **kwargs + ): + """ + :keyword provider: Required. Defines the workload provider. + :paramtype provider: str + :keyword resource: Required. Defines the workload resource. + :paramtype resource: str + :keyword operation: Required. Defines the workload operation. + :paramtype operation: str + :keyword description: Required. Describes the workload operation. + :paramtype description: str + """ + super(OperationsDisplayDefinition, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationsDefinitionDisplay(OperationsDisplayDefinition): + """Display information of the operation. + + All required parameters must be populated in order to send to Azure. + + :ivar provider: Required. Defines the workload provider. + :vartype provider: str + :ivar resource: Required. Defines the workload resource. + :vartype resource: str + :ivar operation: Required. Defines the workload operation. + :vartype operation: str + :ivar description: Required. Describes the workload operation. + :vartype description: str + """ + + _validation = { + 'provider': {'required': True}, + 'resource': {'required': True}, + 'operation': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: str, + resource: str, + operation: str, + description: str, + **kwargs + ): + """ + :keyword provider: Required. Defines the workload provider. + :paramtype provider: str + :keyword resource: Required. Defines the workload resource. + :paramtype resource: str + :keyword operation: Required. Defines the workload operation. + :paramtype operation: str + :keyword description: Required. Describes the workload operation. + :paramtype description: str + """ + super(OperationsDefinitionDisplay, self).__init__(provider=provider, resource=resource, operation=operation, description=description, **kwargs) + + +class OperationStatusResult(msrest.serialization.Model): + """The current status of an async operation. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: list[~azure.mgmt.workloads.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.workloads.models.ErrorDetail + """ + + _validation = { + 'status': {'required': True}, + 'percent_complete': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'operations': {'key': 'operations', 'type': '[OperationStatusResult]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["OperationStatusResult"]] = None, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: list[~azure.mgmt.workloads.models.OperationStatusResult] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.workloads.models.ErrorDetail + """ + super(OperationStatusResult, self).__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error + + +class OsImageProfile(msrest.serialization.Model): + """OS image profile. + + :ivar publisher: OS image publisher. Possible values include: "Canonical". + :vartype publisher: str or ~azure.mgmt.workloads.models.OSImagePublisher + :ivar offer: OS image offer. Possible values include: "UbuntuServer". + :vartype offer: str or ~azure.mgmt.workloads.models.OSImageOffer + :ivar sku: OS image sku. Possible values include: "18.04-LTS", "16.04-LTS". + :vartype sku: str or ~azure.mgmt.workloads.models.OSImageSku + :ivar version: OS image version. Possible values include: "latest". + :vartype version: str or ~azure.mgmt.workloads.models.OSImageVersion + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: Optional[Union[str, "OSImagePublisher"]] = None, + offer: Optional[Union[str, "OSImageOffer"]] = None, + sku: Optional[Union[str, "OSImageSku"]] = None, + version: Optional[Union[str, "OSImageVersion"]] = None, + **kwargs + ): + """ + :keyword publisher: OS image publisher. Possible values include: "Canonical". + :paramtype publisher: str or ~azure.mgmt.workloads.models.OSImagePublisher + :keyword offer: OS image offer. Possible values include: "UbuntuServer". + :paramtype offer: str or ~azure.mgmt.workloads.models.OSImageOffer + :keyword sku: OS image sku. Possible values include: "18.04-LTS", "16.04-LTS". + :paramtype sku: str or ~azure.mgmt.workloads.models.OSImageSku + :keyword version: OS image version. Possible values include: "latest". + :paramtype version: str or ~azure.mgmt.workloads.models.OSImageVersion + """ + super(OsImageProfile, self).__init__(**kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + self.version = version + + +class OSProfile(msrest.serialization.Model): + """Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is provisioned. + + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + This property cannot be updated after the VM is created. :code:`
`:code:`
` + **Windows-only restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length (Linux):** 1 character + :code:`
`:code:`
` **Max-length (Linux):** 64 characters :code:`
`:code:`
` + **Max-length (Windows):** 20 characters. + :vartype admin_username: str + :ivar admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length (Windows):** 8 characters :code:`
`:code:`
` + **Minimum-length (Linux):** 6 characters :code:`
`:code:`
` **Max-length (Windows):** 123 + characters :code:`
`:code:`
` **Max-length (Linux):** 72 characters + :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled :code:`
` Has lower characters :code:`
`Has upper characters :code:`
` Has a + digit :code:`
` Has a special character (Regex match [\W_]) :code:`
`:code:`
` + **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
`:code:`
` For + resetting the password, see `How to reset the Remote Desktop service or its login password in a + Windows VM `_ + :code:`
`:code:`
` For resetting root password, see `Manage users, SSH, and check or + repair disks on Azure Linux VMs using the VMAccess Extension + `_. + :vartype admin_password: str + :ivar os_configuration: Specifies Windows operating system settings on the virtual machine. + :vartype os_configuration: ~azure.mgmt.workloads.models.OSConfiguration + """ + + _attribute_map = { + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + 'os_configuration': {'key': 'osConfiguration', 'type': 'OSConfiguration'}, + } + + def __init__( + self, + *, + admin_username: Optional[str] = None, + admin_password: Optional[str] = None, + os_configuration: Optional["OSConfiguration"] = None, + **kwargs + ): + """ + :keyword admin_username: Specifies the name of the administrator account. + :code:`
`:code:`
` This property cannot be updated after the VM is created. + :code:`
`:code:`
` **Windows-only restriction:** Cannot end in "." + :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", + "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", + "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + :code:`
`:code:`
` **Minimum-length (Linux):** 1 character :code:`
`:code:`
` + **Max-length (Linux):** 64 characters :code:`
`:code:`
` **Max-length (Windows):** 20 + characters. + :paramtype admin_username: str + :keyword admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length (Windows):** 8 characters :code:`
`:code:`
` + **Minimum-length (Linux):** 6 characters :code:`
`:code:`
` **Max-length (Windows):** 123 + characters :code:`
`:code:`
` **Max-length (Linux):** 72 characters + :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled :code:`
` Has lower characters :code:`
`Has upper characters :code:`
` Has a + digit :code:`
` Has a special character (Regex match [\W_]) :code:`
`:code:`
` + **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
`:code:`
` For + resetting the password, see `How to reset the Remote Desktop service or its login password in a + Windows VM `_ + :code:`
`:code:`
` For resetting root password, see `Manage users, SSH, and check or + repair disks on Azure Linux VMs using the VMAccess Extension + `_. + :paramtype admin_password: str + :keyword os_configuration: Specifies Windows operating system settings on the virtual machine. + :paramtype os_configuration: ~azure.mgmt.workloads.models.OSConfiguration + """ + super(OSProfile, self).__init__(**kwargs) + self.admin_username = admin_username + self.admin_password = admin_password + self.os_configuration = os_configuration + + +class OsSapConfiguration(msrest.serialization.Model): + """Defines the OS and SAP Configurations for Deployment. + + :ivar deployer_vm_packages: The url and storage account ID where deployer VM packages are + uploaded. + :vartype deployer_vm_packages: ~azure.mgmt.workloads.models.DeployerVmPackages + :ivar sap_fqdn: The FQDN to set for the SAP system. + :vartype sap_fqdn: str + """ + + _attribute_map = { + 'deployer_vm_packages': {'key': 'deployerVmPackages', 'type': 'DeployerVmPackages'}, + 'sap_fqdn': {'key': 'sapFqdn', 'type': 'str'}, + } + + def __init__( + self, + *, + deployer_vm_packages: Optional["DeployerVmPackages"] = None, + sap_fqdn: Optional[str] = None, + **kwargs + ): + """ + :keyword deployer_vm_packages: The url and storage account ID where deployer VM packages are + uploaded. + :paramtype deployer_vm_packages: ~azure.mgmt.workloads.models.DeployerVmPackages + :keyword sap_fqdn: The FQDN to set for the SAP system. + :paramtype sap_fqdn: str + """ + super(OsSapConfiguration, self).__init__(**kwargs) + self.deployer_vm_packages = deployer_vm_packages + self.sap_fqdn = sap_fqdn + + +class PatchResourceRequestBody(msrest.serialization.Model): + """Resource patch request body. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: + :vartype identity: ~azure.mgmt.workloads.models.PatchResourceRequestBodyIdentity + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'PatchResourceRequestBodyIdentity'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["PatchResourceRequestBodyIdentity"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: + :paramtype identity: ~azure.mgmt.workloads.models.PatchResourceRequestBodyIdentity + """ + super(PatchResourceRequestBody, self).__init__(**kwargs) + self.tags = tags + self.identity = identity + + +class UserAssignedServiceIdentity(msrest.serialization.Model): + """Managed service identity (user assigned identities). + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of manage identity. Possible values include: "None", "UserAssigned". + :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType + :ivar user_assigned_identities: User assigned identities dictionary. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Required. Type of manage identity. Possible values include: "None", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType + :keyword user_assigned_identities: User assigned identities dictionary. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.workloads.models.UserAssignedIdentity] + """ + super(UserAssignedServiceIdentity, self).__init__(**kwargs) + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class PatchResourceRequestBodyIdentity(UserAssignedServiceIdentity): + """PatchResourceRequestBodyIdentity. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of manage identity. Possible values include: "None", "UserAssigned". + :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType + :ivar user_assigned_identities: User assigned identities dictionary. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Required. Type of manage identity. Possible values include: "None", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType + :keyword user_assigned_identities: User assigned identities dictionary. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.workloads.models.UserAssignedIdentity] + """ + super(PatchResourceRequestBodyIdentity, self).__init__(type=type, user_assigned_identities=user_assigned_identities, **kwargs) + + +class PhpProfile(msrest.serialization.Model): + """PHP profile. + + All required parameters must be populated in order to send to Azure. + + :ivar version: Required. PHP version. Possible values include: "7.2", "7.3", "7.4". + :vartype version: str or ~azure.mgmt.workloads.models.PHPVersion + """ + + _validation = { + 'version': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Union[str, "PHPVersion"], + **kwargs + ): + """ + :keyword version: Required. PHP version. Possible values include: "7.2", "7.3", "7.4". + :paramtype version: str or ~azure.mgmt.workloads.models.PHPVersion + """ + super(PhpProfile, self).__init__(**kwargs) + self.version = version + + +class PhpWorkloadResource(TrackedResource): + """Php workload resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar kind: Required. Indicates which kind of php workload this resource represent e.g + WordPress. Possible values include: "WordPress". + :vartype kind: str or ~azure.mgmt.workloads.models.WorkloadKind + :ivar sku: Php workloads SKU. + :vartype sku: ~azure.mgmt.workloads.models.Sku + :ivar identity: Identity for the resource. Currently not supported. + :vartype identity: ~azure.mgmt.workloads.models.PhpWorkloadResourceIdentity + :ivar app_location: The infra resources for PHP workload will be created in this location. + :vartype app_location: str + :ivar managed_resource_group_configuration: Managed resource group configuration of the + workload. + :vartype managed_resource_group_configuration: + ~azure.mgmt.workloads.models.ManagedRGConfiguration + :ivar admin_user_profile: Admin user profile used for VM and VMSS. + :vartype admin_user_profile: ~azure.mgmt.workloads.models.UserProfile + :ivar web_nodes_profile: VMSS web nodes profile. + :vartype web_nodes_profile: ~azure.mgmt.workloads.models.VmssNodesProfile + :ivar controller_profile: Controller VM profile. + :vartype controller_profile: ~azure.mgmt.workloads.models.NodeProfile + :ivar network_profile: Network profile. + :vartype network_profile: ~azure.mgmt.workloads.models.NetworkProfile + :ivar database_profile: Database profile. + :vartype database_profile: ~azure.mgmt.workloads.models.DatabaseProfile + :ivar site_profile: Site profile. + :vartype site_profile: ~azure.mgmt.workloads.models.SiteProfile + :ivar fileshare_profile: File share profile. + :vartype fileshare_profile: ~azure.mgmt.workloads.models.FileshareProfile + :ivar php_profile: PHP profile. + :vartype php_profile: ~azure.mgmt.workloads.models.PhpProfile + :ivar search_profile: Search profile. + :vartype search_profile: ~azure.mgmt.workloads.models.SearchProfile + :ivar cache_profile: Cache profile. + :vartype cache_profile: ~azure.mgmt.workloads.models.CacheProfile + :ivar backup_profile: Backup profile. + :vartype backup_profile: ~azure.mgmt.workloads.models.BackupProfile + :ivar provisioning_state: Php workload resource provisioning state. Possible values include: + "NotSpecified", "Accepted", "Created", "Succeeded", "Failed", "Canceled", "Provisioning", + "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.workloads.models.PhpWorkloadProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'kind': {'required': True}, + 'provisioning_state': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'PhpWorkloadResourceIdentity'}, + 'app_location': {'key': 'properties.appLocation', 'type': 'str'}, + 'managed_resource_group_configuration': {'key': 'properties.managedResourceGroupConfiguration', 'type': 'ManagedRGConfiguration'}, + 'admin_user_profile': {'key': 'properties.adminUserProfile', 'type': 'UserProfile'}, + 'web_nodes_profile': {'key': 'properties.webNodesProfile', 'type': 'VmssNodesProfile'}, + 'controller_profile': {'key': 'properties.controllerProfile', 'type': 'NodeProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'database_profile': {'key': 'properties.databaseProfile', 'type': 'DatabaseProfile'}, + 'site_profile': {'key': 'properties.siteProfile', 'type': 'SiteProfile'}, + 'fileshare_profile': {'key': 'properties.fileshareProfile', 'type': 'FileshareProfile'}, + 'php_profile': {'key': 'properties.phpProfile', 'type': 'PhpProfile'}, + 'search_profile': {'key': 'properties.searchProfile', 'type': 'SearchProfile'}, + 'cache_profile': {'key': 'properties.cacheProfile', 'type': 'CacheProfile'}, + 'backup_profile': {'key': 'properties.backupProfile', 'type': 'BackupProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + kind: Union[str, "WorkloadKind"], + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + identity: Optional["PhpWorkloadResourceIdentity"] = None, + app_location: Optional[str] = None, + managed_resource_group_configuration: Optional["ManagedRGConfiguration"] = None, + admin_user_profile: Optional["UserProfile"] = None, + web_nodes_profile: Optional["VmssNodesProfile"] = None, + controller_profile: Optional["NodeProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + database_profile: Optional["DatabaseProfile"] = None, + site_profile: Optional["SiteProfile"] = None, + fileshare_profile: Optional["FileshareProfile"] = None, + php_profile: Optional["PhpProfile"] = None, + search_profile: Optional["SearchProfile"] = None, + cache_profile: Optional["CacheProfile"] = None, + backup_profile: Optional["BackupProfile"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword kind: Required. Indicates which kind of php workload this resource represent e.g + WordPress. Possible values include: "WordPress". + :paramtype kind: str or ~azure.mgmt.workloads.models.WorkloadKind + :keyword sku: Php workloads SKU. + :paramtype sku: ~azure.mgmt.workloads.models.Sku + :keyword identity: Identity for the resource. Currently not supported. + :paramtype identity: ~azure.mgmt.workloads.models.PhpWorkloadResourceIdentity + :keyword app_location: The infra resources for PHP workload will be created in this location. + :paramtype app_location: str + :keyword managed_resource_group_configuration: Managed resource group configuration of the + workload. + :paramtype managed_resource_group_configuration: + ~azure.mgmt.workloads.models.ManagedRGConfiguration + :keyword admin_user_profile: Admin user profile used for VM and VMSS. + :paramtype admin_user_profile: ~azure.mgmt.workloads.models.UserProfile + :keyword web_nodes_profile: VMSS web nodes profile. + :paramtype web_nodes_profile: ~azure.mgmt.workloads.models.VmssNodesProfile + :keyword controller_profile: Controller VM profile. + :paramtype controller_profile: ~azure.mgmt.workloads.models.NodeProfile + :keyword network_profile: Network profile. + :paramtype network_profile: ~azure.mgmt.workloads.models.NetworkProfile + :keyword database_profile: Database profile. + :paramtype database_profile: ~azure.mgmt.workloads.models.DatabaseProfile + :keyword site_profile: Site profile. + :paramtype site_profile: ~azure.mgmt.workloads.models.SiteProfile + :keyword fileshare_profile: File share profile. + :paramtype fileshare_profile: ~azure.mgmt.workloads.models.FileshareProfile + :keyword php_profile: PHP profile. + :paramtype php_profile: ~azure.mgmt.workloads.models.PhpProfile + :keyword search_profile: Search profile. + :paramtype search_profile: ~azure.mgmt.workloads.models.SearchProfile + :keyword cache_profile: Cache profile. + :paramtype cache_profile: ~azure.mgmt.workloads.models.CacheProfile + :keyword backup_profile: Backup profile. + :paramtype backup_profile: ~azure.mgmt.workloads.models.BackupProfile + """ + super(PhpWorkloadResource, self).__init__(tags=tags, location=location, **kwargs) + self.kind = kind + self.sku = sku + self.identity = identity + self.app_location = app_location + self.managed_resource_group_configuration = managed_resource_group_configuration + self.admin_user_profile = admin_user_profile + self.web_nodes_profile = web_nodes_profile + self.controller_profile = controller_profile + self.network_profile = network_profile + self.database_profile = database_profile + self.site_profile = site_profile + self.fileshare_profile = fileshare_profile + self.php_profile = php_profile + self.search_profile = search_profile + self.cache_profile = cache_profile + self.backup_profile = backup_profile + self.provisioning_state = None + + +class PhpWorkloadResourceIdentity(UserAssignedServiceIdentity): + """Identity for the resource. Currently not supported. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of manage identity. Possible values include: "None", "UserAssigned". + :vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType + :ivar user_assigned_identities: User assigned identities dictionary. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.workloads.models.UserAssignedIdentity] + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Required. Type of manage identity. Possible values include: "None", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType + :keyword user_assigned_identities: User assigned identities dictionary. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.workloads.models.UserAssignedIdentity] + """ + super(PhpWorkloadResourceIdentity, self).__init__(type=type, user_assigned_identities=user_assigned_identities, **kwargs) + + +class PhpWorkloadResourceList(msrest.serialization.Model): + """Php workload resource list. + + :ivar value: List of resources in current page. + :vartype value: list[~azure.mgmt.workloads.models.PhpWorkloadResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PhpWorkloadResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PhpWorkloadResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: List of resources in current page. + :paramtype value: list[~azure.mgmt.workloads.models.PhpWorkloadResource] + :keyword next_link: Link to next page of resources. + :paramtype next_link: str + """ + super(PhpWorkloadResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrometheusHaClusterProviderInstanceProperties(ProviderSpecificProperties): + """Gets or sets the PrometheusHaCluster provider properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_type: Required. The provider type. For example, the value can be + SapHana.Constant filled by server. + :vartype provider_type: str + :ivar prometheus_url: URL of the Node Exporter endpoint. + :vartype prometheus_url: str + :ivar hostname: Gets or sets the target machine name. + :vartype hostname: str + :ivar sid: Gets or sets the cluster sid. + :vartype sid: str + :ivar cluster_name: Gets or sets the clusterName. + :vartype cluster_name: str + """ + + _validation = { + 'provider_type': {'required': True}, + } + + _attribute_map = { + 'provider_type': {'key': 'providerType', 'type': 'str'}, + 'prometheus_url': {'key': 'prometheusUrl', 'type': 'str'}, + 'hostname': {'key': 'hostname', 'type': 'str'}, + 'sid': {'key': 'sid', 'type': 'str'}, + 'cluster_name': {'key': 'clusterName', 'type': 'str'}, + } + + def __init__( + self, + *, + prometheus_url: Optional[str] = None, + hostname: Optional[str] = None, + sid: Optional[str] = None, + cluster_name: Optional[str] = None, + **kwargs + ): + """ + :keyword prometheus_url: URL of the Node Exporter endpoint. + :paramtype prometheus_url: str + :keyword hostname: Gets or sets the target machine name. + :paramtype hostname: str + :keyword sid: Gets or sets the cluster sid. + :paramtype sid: str + :keyword cluster_name: Gets or sets the clusterName. + :paramtype cluster_name: str + """ + super(PrometheusHaClusterProviderInstanceProperties, self).__init__(**kwargs) + self.provider_type = 'PrometheusHaCluster' # type: str + self.prometheus_url = prometheus_url + self.hostname = hostname + self.sid = sid + self.cluster_name = cluster_name + + +class PrometheusOSProviderInstanceProperties(ProviderSpecificProperties): + """Gets or sets the PrometheusOS provider properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_type: Required. The provider type. For example, the value can be + SapHana.Constant filled by server. + :vartype provider_type: str + :ivar prometheus_url: URL of the Node Exporter endpoint. + :vartype prometheus_url: str + """ + + _validation = { + 'provider_type': {'required': True}, + } + + _attribute_map = { + 'provider_type': {'key': 'providerType', 'type': 'str'}, + 'prometheus_url': {'key': 'prometheusUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + prometheus_url: Optional[str] = None, + **kwargs + ): + """ + :keyword prometheus_url: URL of the Node Exporter endpoint. + :paramtype prometheus_url: str + """ + super(PrometheusOSProviderInstanceProperties, self).__init__(**kwargs) + self.provider_type = 'PrometheusOS' # type: str + self.prometheus_url = prometheus_url + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class ProviderInstance(ProxyResource): + """A provider instance associated with SAP monitor. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar identity: Managed service identity (user assigned identities). + :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + :ivar provisioning_state: State of provisioning of the provider instance. Possible values + include: "Accepted", "Creating", "Updating", "Failed", "Succeeded", "Deleting", "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.models.WorkloadMonitorProvisioningState + :ivar errors: Defines the provider instance errors. + :vartype errors: ~azure.mgmt.workloads.models.ProviderInstancePropertiesErrors + :ivar provider_settings: Defines the provider instance errors. + :vartype provider_settings: ~azure.mgmt.workloads.models.ProviderSpecificProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'errors': {'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'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'errors': {'key': 'properties.errors', 'type': 'ProviderInstancePropertiesErrors'}, + 'provider_settings': {'key': 'properties.providerSettings', 'type': 'ProviderSpecificProperties'}, + } + + def __init__( + self, + *, + identity: Optional["UserAssignedServiceIdentity"] = None, + provider_settings: Optional["ProviderSpecificProperties"] = None, + **kwargs + ): + """ + :keyword identity: Managed service identity (user assigned identities). + :paramtype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + :keyword provider_settings: Defines the provider instance errors. + :paramtype provider_settings: ~azure.mgmt.workloads.models.ProviderSpecificProperties + """ + super(ProviderInstance, self).__init__(**kwargs) + self.identity = identity + self.provisioning_state = None + self.errors = None + self.provider_settings = provider_settings + + +class ProviderInstanceListResult(msrest.serialization.Model): + """The response from the List provider instances operation. + + :ivar value: The list of provider instances. + :vartype value: list[~azure.mgmt.workloads.models.ProviderInstance] + :ivar next_link: The URL to get the next set of provider instances. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProviderInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ProviderInstance"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of provider instances. + :paramtype value: list[~azure.mgmt.workloads.models.ProviderInstance] + :keyword next_link: The URL to get the next set of provider instances. + :paramtype next_link: str + """ + super(ProviderInstanceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ProviderInstancePropertiesErrors(Error): + """Defines the provider instance errors. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Server-defined set of error codes. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar target: Target of the error. + :vartype target: str + :ivar details: Array of details about specific errors that led to this reported error. + :vartype details: list[~azure.mgmt.workloads.models.Error] + :ivar inner_error: Object containing more specific information than the current object about + the error. + :vartype inner_error: ~azure.mgmt.workloads.models.ErrorInnerError + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'ErrorInnerError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProviderInstancePropertiesErrors, self).__init__(**kwargs) + + +class RestrictionInfo(msrest.serialization.Model): + """The SKU restriction information. + + :ivar locations: The restriction locations. + :vartype locations: list[str] + :ivar zones: The restriction zones. + :vartype zones: list[str] + """ + + _attribute_map = { + 'locations': {'key': 'locations', 'type': '[str]'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword locations: The restriction locations. + :paramtype locations: list[str] + :keyword zones: The restriction zones. + :paramtype zones: list[str] + """ + super(RestrictionInfo, self).__init__(**kwargs) + self.locations = locations + self.zones = zones + + +class SAPApplicationServerInstance(TrackedResource): + """Define the SAP Application Server Instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar instance_no: The application server instance id. + :vartype instance_no: str + :ivar subnet: The application server subnet. + :vartype subnet: str + :ivar hostname: The application server SAP host name. + :vartype hostname: str + :ivar kernel_version: The application server SAP kernel version. + :vartype kernel_version: str + :ivar kernel_patch: The application server SAP kernel patch. + :vartype kernel_patch: str + :ivar ip_address: The application server SAP IP Address. + :vartype ip_address: str + :ivar gateway_port: The application server gateway Port. + :vartype gateway_port: long + :ivar icm_http_port: The application server ICM HTTP Port. + :vartype icm_http_port: long + :ivar icm_https_port: The application server ICM HTTPS Port. + :vartype icm_https_port: long + :ivar virtual_machine_id: The virtual machine. + :vartype virtual_machine_id: str + :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable". + :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus + :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + "Unhealthy", "Degraded". + :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState + :ivar provisioning_state: Defines the provisioning states. Possible values include: + "Succeeded", "Updating", "Creating", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the Application Instance errors. + :vartype errors: ~azure.mgmt.workloads.models.SAPVirtualInstanceError + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'instance_no': {'readonly': True}, + 'subnet': {'readonly': True}, + 'hostname': {'readonly': True}, + 'kernel_version': {'readonly': True}, + 'kernel_patch': {'readonly': True}, + 'ip_address': {'readonly': True}, + 'gateway_port': {'readonly': True}, + 'icm_http_port': {'readonly': True}, + 'icm_https_port': {'readonly': True}, + 'virtual_machine_id': {'readonly': True}, + 'status': {'readonly': True}, + 'health': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'errors': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'instance_no': {'key': 'properties.instanceNo', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'str'}, + 'hostname': {'key': 'properties.hostname', 'type': 'str'}, + 'kernel_version': {'key': 'properties.kernelVersion', 'type': 'str'}, + 'kernel_patch': {'key': 'properties.kernelPatch', 'type': 'str'}, + 'ip_address': {'key': 'properties.ipAddress', 'type': 'str'}, + 'gateway_port': {'key': 'properties.gatewayPort', 'type': 'long'}, + 'icm_http_port': {'key': 'properties.icmHttpPort', 'type': 'long'}, + 'icm_https_port': {'key': 'properties.icmHttpsPort', 'type': 'long'}, + 'virtual_machine_id': {'key': 'properties.virtualMachineId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'health': {'key': 'properties.health', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'errors': {'key': 'properties.errors', 'type': 'SAPVirtualInstanceError'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(SAPApplicationServerInstance, self).__init__(tags=tags, location=location, **kwargs) + self.instance_no = None + self.subnet = None + self.hostname = None + self.kernel_version = None + self.kernel_patch = None + self.ip_address = None + self.gateway_port = None + self.icm_http_port = None + self.icm_https_port = None + self.virtual_machine_id = None + self.status = None + self.health = None + self.provisioning_state = None + self.errors = None + + +class SAPApplicationServerInstanceList(msrest.serialization.Model): + """Defines the collection of SAP Application Server Instances. + + :ivar value: Gets the list of SAP Application Server instances. + :vartype value: list[~azure.mgmt.workloads.models.SAPApplicationServerInstance] + :ivar next_link: Gets the value of next link. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SAPApplicationServerInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SAPApplicationServerInstance"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Gets the list of SAP Application Server instances. + :paramtype value: list[~azure.mgmt.workloads.models.SAPApplicationServerInstance] + :keyword next_link: Gets the value of next link. + :paramtype next_link: str + """ + super(SAPApplicationServerInstanceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SAPAvailabilityZoneDetailsRequest(msrest.serialization.Model): + """The SAP request to get list of availability zones. + + All required parameters must be populated in order to send to Azure. + + :ivar app_location: Required. The geo-location where the SAP resources will be created. + :vartype app_location: str + :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values include: + "HANA", "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + """ + + _validation = { + 'app_location': {'required': True}, + 'sap_product': {'required': True}, + 'database_type': {'required': True}, + } + + _attribute_map = { + 'app_location': {'key': 'appLocation', 'type': 'str'}, + 'sap_product': {'key': 'sapProduct', 'type': 'str'}, + 'database_type': {'key': 'databaseType', 'type': 'str'}, + } + + def __init__( + self, + *, + app_location: str, + sap_product: Union[str, "SAPProductType"], + database_type: Union[str, "SAPDatabaseType"], + **kwargs + ): + """ + :keyword app_location: Required. The geo-location where the SAP resources will be created. + :paramtype app_location: str + :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values + include: "HANA", "DB2". + :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + """ + super(SAPAvailabilityZoneDetailsRequest, self).__init__(**kwargs) + self.app_location = app_location + self.sap_product = sap_product + self.database_type = database_type + + +class SAPAvailabilityZoneDetailsResult(msrest.serialization.Model): + """The list of supported availability zone pairs which are part of SAP HA deployment. + + :ivar availability_zone_pairs: Gets the list of availability zone pairs. + :vartype availability_zone_pairs: list[~azure.mgmt.workloads.models.SAPAvailabilityZonePair] + """ + + _attribute_map = { + 'availability_zone_pairs': {'key': 'availabilityZonePairs', 'type': '[SAPAvailabilityZonePair]'}, + } + + def __init__( + self, + *, + availability_zone_pairs: Optional[List["SAPAvailabilityZonePair"]] = None, + **kwargs + ): + """ + :keyword availability_zone_pairs: Gets the list of availability zone pairs. + :paramtype availability_zone_pairs: list[~azure.mgmt.workloads.models.SAPAvailabilityZonePair] + """ + super(SAPAvailabilityZoneDetailsResult, self).__init__(**kwargs) + self.availability_zone_pairs = availability_zone_pairs + + +class SAPAvailabilityZonePair(msrest.serialization.Model): + """The SAP Availability Zone Pair. + + :ivar zone_a: The zone A. + :vartype zone_a: long + :ivar zone_b: The zone B. + :vartype zone_b: long + """ + + _attribute_map = { + 'zone_a': {'key': 'zoneA', 'type': 'long'}, + 'zone_b': {'key': 'zoneB', 'type': 'long'}, + } + + def __init__( + self, + *, + zone_a: Optional[int] = None, + zone_b: Optional[int] = None, + **kwargs + ): + """ + :keyword zone_a: The zone A. + :paramtype zone_a: long + :keyword zone_b: The zone B. + :paramtype zone_b: long + """ + super(SAPAvailabilityZonePair, self).__init__(**kwargs) + self.zone_a = zone_a + self.zone_b = zone_b + + +class SAPCentralInstanceList(msrest.serialization.Model): + """Defines the collection of SAP Central Instances. + + :ivar value: Gets the list of SAP central instances. + :vartype value: list[~azure.mgmt.workloads.models.SAPCentralServerInstance] + :ivar next_link: Gets the value of next link. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SAPCentralServerInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SAPCentralServerInstance"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Gets the list of SAP central instances. + :paramtype value: list[~azure.mgmt.workloads.models.SAPCentralServerInstance] + :keyword next_link: Gets the value of next link. + :paramtype next_link: str + """ + super(SAPCentralInstanceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SAPCentralServerInstance(TrackedResource): + """Define the SAP Central Server Instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar instance_no: The central server instance id. + :vartype instance_no: str + :ivar subnet: The central server subnet. + :vartype subnet: str + :ivar message_server_properties: Defines the SAP message server properties. + :vartype message_server_properties: ~azure.mgmt.workloads.models.MessageServerProperties + :ivar enqueue_server_properties: Defines the SAP enqueue server properties. + :vartype enqueue_server_properties: ~azure.mgmt.workloads.models.EnqueueServerProperties + :ivar gateway_server_properties: Defines the SAP Gateway Server properties. + :vartype gateway_server_properties: ~azure.mgmt.workloads.models.GatewayServerProperties + :ivar enqueue_replication_server_properties: Defines the SAP ERS Server properties. + :vartype enqueue_replication_server_properties: + ~azure.mgmt.workloads.models.EnqueueReplicationServerProperties + :ivar kernel_version: The central server kernel version. + :vartype kernel_version: str + :ivar kernel_patch: The central server kernel patch. + :vartype kernel_patch: str + :ivar vm_details: The list of virtual machines. + :vartype vm_details: list[~azure.mgmt.workloads.models.CentralServerVmDetails] + :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable". + :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus + :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + "Unhealthy", "Degraded". + :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState + :ivar provisioning_state: Defines the provisioning states. Possible values include: + "Succeeded", "Updating", "Creating", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the Central Instance errors. + :vartype errors: ~azure.mgmt.workloads.models.SAPVirtualInstanceError + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'instance_no': {'readonly': True}, + 'subnet': {'readonly': True}, + 'kernel_version': {'readonly': True}, + 'kernel_patch': {'readonly': True}, + 'vm_details': {'readonly': True}, + 'status': {'readonly': True}, + 'health': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'errors': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'instance_no': {'key': 'properties.instanceNo', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'str'}, + 'message_server_properties': {'key': 'properties.messageServerProperties', 'type': 'MessageServerProperties'}, + 'enqueue_server_properties': {'key': 'properties.enqueueServerProperties', 'type': 'EnqueueServerProperties'}, + 'gateway_server_properties': {'key': 'properties.gatewayServerProperties', 'type': 'GatewayServerProperties'}, + 'enqueue_replication_server_properties': {'key': 'properties.enqueueReplicationServerProperties', 'type': 'EnqueueReplicationServerProperties'}, + 'kernel_version': {'key': 'properties.kernelVersion', 'type': 'str'}, + 'kernel_patch': {'key': 'properties.kernelPatch', 'type': 'str'}, + 'vm_details': {'key': 'properties.vmDetails', 'type': '[CentralServerVmDetails]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'health': {'key': 'properties.health', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'errors': {'key': 'properties.errors', 'type': 'SAPVirtualInstanceError'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + message_server_properties: Optional["MessageServerProperties"] = None, + enqueue_server_properties: Optional["EnqueueServerProperties"] = None, + gateway_server_properties: Optional["GatewayServerProperties"] = None, + enqueue_replication_server_properties: Optional["EnqueueReplicationServerProperties"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword message_server_properties: Defines the SAP message server properties. + :paramtype message_server_properties: ~azure.mgmt.workloads.models.MessageServerProperties + :keyword enqueue_server_properties: Defines the SAP enqueue server properties. + :paramtype enqueue_server_properties: ~azure.mgmt.workloads.models.EnqueueServerProperties + :keyword gateway_server_properties: Defines the SAP Gateway Server properties. + :paramtype gateway_server_properties: ~azure.mgmt.workloads.models.GatewayServerProperties + :keyword enqueue_replication_server_properties: Defines the SAP ERS Server properties. + :paramtype enqueue_replication_server_properties: + ~azure.mgmt.workloads.models.EnqueueReplicationServerProperties + """ + super(SAPCentralServerInstance, self).__init__(tags=tags, location=location, **kwargs) + self.instance_no = None + self.subnet = None + self.message_server_properties = message_server_properties + self.enqueue_server_properties = enqueue_server_properties + self.gateway_server_properties = gateway_server_properties + self.enqueue_replication_server_properties = enqueue_replication_server_properties + self.kernel_version = None + self.kernel_patch = None + self.vm_details = None + self.status = None + self.health = None + self.provisioning_state = None + self.errors = None + + +class SAPDatabaseInstance(TrackedResource): + """Define the SAP Database Instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar subnet: The database subnet. + :vartype subnet: str + :ivar database_sid: The database SID. + :vartype database_sid: str + :ivar database_type: The SAP database type. + :vartype database_type: str + :ivar ip_address: The database IP Address. + :vartype ip_address: str + :ivar vm_details: The list of virtual machines. + :vartype vm_details: list[~azure.mgmt.workloads.models.DatabaseVmDetails] + :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable". + :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus + :ivar provisioning_state: Defines the provisioning states. Possible values include: + "Succeeded", "Updating", "Creating", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the Database Instance errors. + :vartype errors: ~azure.mgmt.workloads.models.SAPVirtualInstanceError + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'subnet': {'readonly': True}, + 'database_sid': {'readonly': True}, + 'database_type': {'readonly': True}, + 'ip_address': {'readonly': True}, + 'vm_details': {'readonly': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'errors': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'str'}, + 'database_sid': {'key': 'properties.databaseSid', 'type': 'str'}, + 'database_type': {'key': 'properties.databaseType', 'type': 'str'}, + 'ip_address': {'key': 'properties.ipAddress', 'type': 'str'}, + 'vm_details': {'key': 'properties.vmDetails', 'type': '[DatabaseVmDetails]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'errors': {'key': 'properties.errors', 'type': 'SAPVirtualInstanceError'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(SAPDatabaseInstance, self).__init__(tags=tags, location=location, **kwargs) + self.subnet = None + self.database_sid = None + self.database_type = None + self.ip_address = None + self.vm_details = None + self.status = None + self.provisioning_state = None + self.errors = None + + +class SAPDatabaseInstanceList(msrest.serialization.Model): + """Defines the collection of SAP Database Instances. + + :ivar value: Gets the list of SAP Database instances. + :vartype value: list[~azure.mgmt.workloads.models.SAPDatabaseInstance] + :ivar next_link: Gets the value of next link. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SAPDatabaseInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SAPDatabaseInstance"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Gets the list of SAP Database instances. + :paramtype value: list[~azure.mgmt.workloads.models.SAPDatabaseInstance] + :keyword next_link: Gets the value of next link. + :paramtype next_link: str + """ + super(SAPDatabaseInstanceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SAPDiskConfiguration(msrest.serialization.Model): + """The SAP Disk Configuration. + + :ivar volume: The volume name. + :vartype volume: str + :ivar disk_type: The disk type. + :vartype disk_type: str + :ivar disk_count: The disk count. + :vartype disk_count: long + :ivar disk_size_gb: The disk size in GB. + :vartype disk_size_gb: long + :ivar disk_iops_read_write: The disk Iops. + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: The disk provisioned throughput in MBps. + :vartype disk_m_bps_read_write: long + :ivar disk_storage_type: The disk storage type. + :vartype disk_storage_type: str + """ + + _attribute_map = { + 'volume': {'key': 'volume', 'type': 'str'}, + 'disk_type': {'key': 'diskType', 'type': 'str'}, + 'disk_count': {'key': 'diskCount', 'type': 'long'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'long'}, + 'disk_iops_read_write': {'key': 'diskIopsReadWrite', 'type': 'long'}, + 'disk_m_bps_read_write': {'key': 'diskMBpsReadWrite', 'type': 'long'}, + 'disk_storage_type': {'key': 'diskStorageType', 'type': 'str'}, + } + + def __init__( + self, + *, + volume: Optional[str] = None, + disk_type: Optional[str] = None, + disk_count: Optional[int] = None, + disk_size_gb: Optional[int] = None, + disk_iops_read_write: Optional[int] = None, + disk_m_bps_read_write: Optional[int] = None, + disk_storage_type: Optional[str] = None, + **kwargs + ): + """ + :keyword volume: The volume name. + :paramtype volume: str + :keyword disk_type: The disk type. + :paramtype disk_type: str + :keyword disk_count: The disk count. + :paramtype disk_count: long + :keyword disk_size_gb: The disk size in GB. + :paramtype disk_size_gb: long + :keyword disk_iops_read_write: The disk Iops. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: The disk provisioned throughput in MBps. + :paramtype disk_m_bps_read_write: long + :keyword disk_storage_type: The disk storage type. + :paramtype disk_storage_type: str + """ + super(SAPDiskConfiguration, self).__init__(**kwargs) + self.volume = volume + self.disk_type = disk_type + self.disk_count = disk_count + self.disk_size_gb = disk_size_gb + self.disk_iops_read_write = disk_iops_read_write + self.disk_m_bps_read_write = disk_m_bps_read_write + self.disk_storage_type = disk_storage_type + + +class SAPDiskConfigurationsRequest(msrest.serialization.Model): + """The SAP request to get list of disk configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar app_location: Required. The geo-location where the SAP resources will be created. + :vartype app_location: str + :ivar environment: Required. Defines the environment type - Production/Non Production. Possible + values include: "NonProd", "Prod". + :vartype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType + :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values include: + "HANA", "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible + values include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar db_vm_sku: Required. The VM SKU for database instance. + :vartype db_vm_sku: str + """ + + _validation = { + 'app_location': {'required': True}, + 'environment': {'required': True}, + 'sap_product': {'required': True}, + 'database_type': {'required': True}, + 'deployment_type': {'required': True}, + 'db_vm_sku': {'required': True}, + } + + _attribute_map = { + 'app_location': {'key': 'appLocation', 'type': 'str'}, + 'environment': {'key': 'environment', 'type': 'str'}, + 'sap_product': {'key': 'sapProduct', 'type': 'str'}, + 'database_type': {'key': 'databaseType', 'type': 'str'}, + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'db_vm_sku': {'key': 'dbVmSku', 'type': 'str'}, + } + + def __init__( + self, + *, + app_location: str, + environment: Union[str, "SAPEnvironmentType"], + sap_product: Union[str, "SAPProductType"], + database_type: Union[str, "SAPDatabaseType"], + deployment_type: Union[str, "SAPDeploymentType"], + db_vm_sku: str, + **kwargs + ): + """ + :keyword app_location: Required. The geo-location where the SAP resources will be created. + :paramtype app_location: str + :keyword environment: Required. Defines the environment type - Production/Non Production. + Possible values include: "NonProd", "Prod". + :paramtype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType + :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values + include: "HANA", "DB2". + :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible + values include: "SingleServer", "ThreeTier". + :paramtype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :keyword db_vm_sku: Required. The VM SKU for database instance. + :paramtype db_vm_sku: str + """ + super(SAPDiskConfigurationsRequest, self).__init__(**kwargs) + self.app_location = app_location + self.environment = environment + self.sap_product = sap_product + self.database_type = database_type + self.deployment_type = deployment_type + self.db_vm_sku = db_vm_sku + + +class SAPDiskConfigurationsResult(msrest.serialization.Model): + """The list of disk configuration for vmSku which are part of SAP deployment. + + :ivar disk_configurations: Gets the list of Disk Configurations. + :vartype disk_configurations: list[~azure.mgmt.workloads.models.SAPDiskConfiguration] + """ + + _attribute_map = { + 'disk_configurations': {'key': 'diskConfigurations', 'type': '[SAPDiskConfiguration]'}, + } + + def __init__( + self, + *, + disk_configurations: Optional[List["SAPDiskConfiguration"]] = None, + **kwargs + ): + """ + :keyword disk_configurations: Gets the list of Disk Configurations. + :paramtype disk_configurations: list[~azure.mgmt.workloads.models.SAPDiskConfiguration] + """ + super(SAPDiskConfigurationsResult, self).__init__(**kwargs) + self.disk_configurations = disk_configurations + + +class SoftwareConfiguration(msrest.serialization.Model): + """The SAP Software configuration Input. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SAPInstallWithoutOSConfigSoftwareConfiguration, ServiceInitiatedSoftwareConfiguration. + + All required parameters must be populated in order to send to Azure. + + :ivar software_installation_type: Required. The SAP software installation Type.Constant filled + by server. Possible values include: "ServiceInitiated", "SAPInstallWithoutOSConfig". + :vartype software_installation_type: str or + ~azure.mgmt.workloads.models.SAPSoftwareInstallationType + """ + + _validation = { + 'software_installation_type': {'required': True}, + } + + _attribute_map = { + 'software_installation_type': {'key': 'softwareInstallationType', 'type': 'str'}, + } + + _subtype_map = { + 'software_installation_type': {'SAPInstallWithoutOSConfig': 'SAPInstallWithoutOSConfigSoftwareConfiguration', 'ServiceInitiated': 'ServiceInitiatedSoftwareConfiguration'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SoftwareConfiguration, self).__init__(**kwargs) + self.software_installation_type = None # type: Optional[str] + + +class SAPInstallWithoutOSConfigSoftwareConfiguration(SoftwareConfiguration): + """The SAP Software configuration Input when the software is to be installed by service without OS Configurations. + + All required parameters must be populated in order to send to Azure. + + :ivar software_installation_type: Required. The SAP software installation Type.Constant filled + by server. Possible values include: "ServiceInitiated", "SAPInstallWithoutOSConfig". + :vartype software_installation_type: str or + ~azure.mgmt.workloads.models.SAPSoftwareInstallationType + :ivar bom_url: Required. The URL to the SAP Build of Materials(BOM) file. + :vartype bom_url: str + :ivar sap_bits_storage_account_id: Required. The SAP bits storage account id. + :vartype sap_bits_storage_account_id: str + :ivar software_version: Required. The software version to install. + :vartype software_version: str + :ivar high_availability_software_configuration: Gets or sets the HA software configuration. + :vartype high_availability_software_configuration: + ~azure.mgmt.workloads.models.HighAvailabilitySoftwareConfiguration + """ + + _validation = { + 'software_installation_type': {'required': True}, + 'bom_url': {'required': True}, + 'sap_bits_storage_account_id': {'required': True}, + 'software_version': {'required': True}, + } + + _attribute_map = { + 'software_installation_type': {'key': 'softwareInstallationType', 'type': 'str'}, + 'bom_url': {'key': 'bomUrl', 'type': 'str'}, + 'sap_bits_storage_account_id': {'key': 'sapBitsStorageAccountId', 'type': 'str'}, + 'software_version': {'key': 'softwareVersion', 'type': 'str'}, + 'high_availability_software_configuration': {'key': 'highAvailabilitySoftwareConfiguration', 'type': 'HighAvailabilitySoftwareConfiguration'}, + } + + def __init__( + self, + *, + bom_url: str, + sap_bits_storage_account_id: str, + software_version: str, + high_availability_software_configuration: Optional["HighAvailabilitySoftwareConfiguration"] = None, + **kwargs + ): + """ + :keyword bom_url: Required. The URL to the SAP Build of Materials(BOM) file. + :paramtype bom_url: str + :keyword sap_bits_storage_account_id: Required. The SAP bits storage account id. + :paramtype sap_bits_storage_account_id: str + :keyword software_version: Required. The software version to install. + :paramtype software_version: str + :keyword high_availability_software_configuration: Gets or sets the HA software configuration. + :paramtype high_availability_software_configuration: + ~azure.mgmt.workloads.models.HighAvailabilitySoftwareConfiguration + """ + super(SAPInstallWithoutOSConfigSoftwareConfiguration, self).__init__(**kwargs) + self.software_installation_type = 'SAPInstallWithoutOSConfig' # type: str + self.bom_url = bom_url + self.sap_bits_storage_account_id = sap_bits_storage_account_id + self.software_version = software_version + self.high_availability_software_configuration = high_availability_software_configuration + + +class SapNetWeaverProviderInstanceProperties(ProviderSpecificProperties): + """Gets or sets the provider properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provider_type: Required. The provider type. For example, the value can be + SapHana.Constant filled by server. + :vartype provider_type: str + :ivar sap_sid: Gets or sets the SAP System Identifier. + :vartype sap_sid: str + :ivar sap_hostname: Gets or sets the target virtual machine IP Address/FQDN. + :vartype sap_hostname: str + :ivar sap_instance_nr: Gets or sets the instance number of SAP NetWeaver. + :vartype sap_instance_nr: str + :ivar sap_host_file_entries: Gets or sets the list of HostFile Entries. + :vartype sap_host_file_entries: list[str] + :ivar sap_username: Gets or sets the SAP user name. + :vartype sap_username: str + :ivar sap_password: Sets the SAP password. + :vartype sap_password: str + :ivar sap_password_uri: Gets or sets the key vault URI to secret with the SAP password. + :vartype sap_password_uri: str + :ivar sap_client_id: Gets or sets the SAP Client ID. + :vartype sap_client_id: str + :ivar sap_port_number: Gets or sets the SAP HTTP port number. + :vartype sap_port_number: str + :ivar sap_ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the SAP system. + :vartype sap_ssl_certificate_uri: str + """ + + _validation = { + 'provider_type': {'required': True}, + } + + _attribute_map = { + 'provider_type': {'key': 'providerType', 'type': 'str'}, + 'sap_sid': {'key': 'sapSid', 'type': 'str'}, + 'sap_hostname': {'key': 'sapHostname', 'type': 'str'}, + 'sap_instance_nr': {'key': 'sapInstanceNr', 'type': 'str'}, + 'sap_host_file_entries': {'key': 'sapHostFileEntries', 'type': '[str]'}, + 'sap_username': {'key': 'sapUsername', 'type': 'str'}, + 'sap_password': {'key': 'sapPassword', 'type': 'str'}, + 'sap_password_uri': {'key': 'sapPasswordUri', 'type': 'str'}, + 'sap_client_id': {'key': 'sapClientId', 'type': 'str'}, + 'sap_port_number': {'key': 'sapPortNumber', 'type': 'str'}, + 'sap_ssl_certificate_uri': {'key': 'sapSslCertificateUri', 'type': 'str'}, + } + + def __init__( + self, + *, + sap_sid: Optional[str] = None, + sap_hostname: Optional[str] = None, + sap_instance_nr: Optional[str] = None, + sap_host_file_entries: Optional[List[str]] = None, + sap_username: Optional[str] = None, + sap_password: Optional[str] = None, + sap_password_uri: Optional[str] = None, + sap_client_id: Optional[str] = None, + sap_port_number: Optional[str] = None, + sap_ssl_certificate_uri: Optional[str] = None, + **kwargs + ): + """ + :keyword sap_sid: Gets or sets the SAP System Identifier. + :paramtype sap_sid: str + :keyword sap_hostname: Gets or sets the target virtual machine IP Address/FQDN. + :paramtype sap_hostname: str + :keyword sap_instance_nr: Gets or sets the instance number of SAP NetWeaver. + :paramtype sap_instance_nr: str + :keyword sap_host_file_entries: Gets or sets the list of HostFile Entries. + :paramtype sap_host_file_entries: list[str] + :keyword sap_username: Gets or sets the SAP user name. + :paramtype sap_username: str + :keyword sap_password: Sets the SAP password. + :paramtype sap_password: str + :keyword sap_password_uri: Gets or sets the key vault URI to secret with the SAP password. + :paramtype sap_password_uri: str + :keyword sap_client_id: Gets or sets the SAP Client ID. + :paramtype sap_client_id: str + :keyword sap_port_number: Gets or sets the SAP HTTP port number. + :paramtype sap_port_number: str + :keyword sap_ssl_certificate_uri: Gets or sets the blob URI to SSL certificate for the SAP + system. + :paramtype sap_ssl_certificate_uri: str + """ + super(SapNetWeaverProviderInstanceProperties, self).__init__(**kwargs) + self.provider_type = 'SapNetWeaver' # type: str + self.sap_sid = sap_sid + self.sap_hostname = sap_hostname + self.sap_instance_nr = sap_instance_nr + self.sap_host_file_entries = sap_host_file_entries + self.sap_username = sap_username + self.sap_password = sap_password + self.sap_password_uri = sap_password_uri + self.sap_client_id = sap_client_id + self.sap_port_number = sap_port_number + self.sap_ssl_certificate_uri = sap_ssl_certificate_uri + + +class SAPSizingRecommendationRequest(msrest.serialization.Model): + """The SAP Sizing Recommendation request. + + All required parameters must be populated in order to send to Azure. + + :ivar app_location: Required. The geo-location where the resource is to be created. + :vartype app_location: str + :ivar environment: Required. Defines the environment type - Production/Non Production. Possible + values include: "NonProd", "Prod". + :vartype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType + :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible + values include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar saps: Required. The SAP Application Performance Standard measurement. + :vartype saps: long + :ivar db_memory: Required. The database memory configuration. + :vartype db_memory: long + :ivar database_type: Required. The database type. Possible values include: "HANA", "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :ivar db_scale_method: The DB scale method. Possible values include: "ScaleUp". + :vartype db_scale_method: str or ~azure.mgmt.workloads.models.SAPDatabaseScaleMethod + :ivar high_availability_type: The high availability type. Possible values include: + "AvailabilitySet", "AvailabilityZone". + :vartype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType + """ + + _validation = { + 'app_location': {'required': True}, + 'environment': {'required': True}, + 'sap_product': {'required': True}, + 'deployment_type': {'required': True}, + 'saps': {'required': True}, + 'db_memory': {'required': True}, + 'database_type': {'required': True}, + } + + _attribute_map = { + 'app_location': {'key': 'appLocation', 'type': 'str'}, + 'environment': {'key': 'environment', 'type': 'str'}, + 'sap_product': {'key': 'sapProduct', 'type': 'str'}, + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'saps': {'key': 'saps', 'type': 'long'}, + 'db_memory': {'key': 'dbMemory', 'type': 'long'}, + 'database_type': {'key': 'databaseType', 'type': 'str'}, + 'db_scale_method': {'key': 'dbScaleMethod', 'type': 'str'}, + 'high_availability_type': {'key': 'highAvailabilityType', 'type': 'str'}, + } + + def __init__( + self, + *, + app_location: str, + environment: Union[str, "SAPEnvironmentType"], + sap_product: Union[str, "SAPProductType"], + deployment_type: Union[str, "SAPDeploymentType"], + saps: int, + db_memory: int, + database_type: Union[str, "SAPDatabaseType"], + db_scale_method: Optional[Union[str, "SAPDatabaseScaleMethod"]] = None, + high_availability_type: Optional[Union[str, "SAPHighAvailabilityType"]] = None, + **kwargs + ): + """ + :keyword app_location: Required. The geo-location where the resource is to be created. + :paramtype app_location: str + :keyword environment: Required. Defines the environment type - Production/Non Production. + Possible values include: "NonProd", "Prod". + :paramtype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType + :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible + values include: "SingleServer", "ThreeTier". + :paramtype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :keyword saps: Required. The SAP Application Performance Standard measurement. + :paramtype saps: long + :keyword db_memory: Required. The database memory configuration. + :paramtype db_memory: long + :keyword database_type: Required. The database type. Possible values include: "HANA", "DB2". + :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :keyword db_scale_method: The DB scale method. Possible values include: "ScaleUp". + :paramtype db_scale_method: str or ~azure.mgmt.workloads.models.SAPDatabaseScaleMethod + :keyword high_availability_type: The high availability type. Possible values include: + "AvailabilitySet", "AvailabilityZone". + :paramtype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType + """ + super(SAPSizingRecommendationRequest, self).__init__(**kwargs) + self.app_location = app_location + self.environment = environment + self.sap_product = sap_product + self.deployment_type = deployment_type + self.saps = saps + self.db_memory = db_memory + self.database_type = database_type + self.db_scale_method = db_scale_method + self.high_availability_type = high_availability_type + + +class SAPSizingRecommendationResult(msrest.serialization.Model): + """The SAP sizing recommendation result. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SingleServerRecommendationResult, ThreeTierRecommendationResult. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values + include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + """ + + _validation = { + 'deployment_type': {'required': True}, + } + + _attribute_map = { + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + } + + _subtype_map = { + 'deployment_type': {'SingleServer': 'SingleServerRecommendationResult', 'ThreeTier': 'ThreeTierRecommendationResult'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SAPSizingRecommendationResult, self).__init__(**kwargs) + self.deployment_type = None # type: Optional[str] + + +class SAPSupportedResourceSkusResult(msrest.serialization.Model): + """The list of supported SKUs for different resources which are part of SAP deployment. + + :ivar supported_skus: Gets the list of SAP supported SKUs. + :vartype supported_skus: list[~azure.mgmt.workloads.models.SAPSupportedSku] + """ + + _attribute_map = { + 'supported_skus': {'key': 'supportedSkus', 'type': '[SAPSupportedSku]'}, + } + + def __init__( + self, + *, + supported_skus: Optional[List["SAPSupportedSku"]] = None, + **kwargs + ): + """ + :keyword supported_skus: Gets the list of SAP supported SKUs. + :paramtype supported_skus: list[~azure.mgmt.workloads.models.SAPSupportedSku] + """ + super(SAPSupportedResourceSkusResult, self).__init__(**kwargs) + self.supported_skus = supported_skus + + +class SAPSupportedSku(msrest.serialization.Model): + """The SAP supported SKU. + + :ivar vm_sku: The VM Sku. + :vartype vm_sku: str + :ivar is_app_server_certified: True if the Sku is certified for App server in the SAP system. + :vartype is_app_server_certified: bool + :ivar is_database_certified: True if the Sku is certified for Database server in the SAP + system. + :vartype is_database_certified: bool + """ + + _attribute_map = { + 'vm_sku': {'key': 'vmSku', 'type': 'str'}, + 'is_app_server_certified': {'key': 'isAppServerCertified', 'type': 'bool'}, + 'is_database_certified': {'key': 'isDatabaseCertified', 'type': 'bool'}, + } + + def __init__( + self, + *, + vm_sku: Optional[str] = None, + is_app_server_certified: Optional[bool] = None, + is_database_certified: Optional[bool] = None, + **kwargs + ): + """ + :keyword vm_sku: The VM Sku. + :paramtype vm_sku: str + :keyword is_app_server_certified: True if the Sku is certified for App server in the SAP + system. + :paramtype is_app_server_certified: bool + :keyword is_database_certified: True if the Sku is certified for Database server in the SAP + system. + :paramtype is_database_certified: bool + """ + super(SAPSupportedSku, self).__init__(**kwargs) + self.vm_sku = vm_sku + self.is_app_server_certified = is_app_server_certified + self.is_database_certified = is_database_certified + + +class SAPSupportedSkusRequest(msrest.serialization.Model): + """The SAP request to get list of supported SKUs. + + All required parameters must be populated in order to send to Azure. + + :ivar app_location: Required. The geo-location where the resource is to be created. + :vartype app_location: str + :ivar environment: Required. Defines the environment type - Production/Non Production. Possible + values include: "NonProd", "Prod". + :vartype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType + :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :ivar deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible + values include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values include: + "HANA", "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :ivar high_availability_type: The high availability type. Possible values include: + "AvailabilitySet", "AvailabilityZone". + :vartype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType + """ + + _validation = { + 'app_location': {'required': True}, + 'environment': {'required': True}, + 'sap_product': {'required': True}, + 'deployment_type': {'required': True}, + 'database_type': {'required': True}, + } + + _attribute_map = { + 'app_location': {'key': 'appLocation', 'type': 'str'}, + 'environment': {'key': 'environment', 'type': 'str'}, + 'sap_product': {'key': 'sapProduct', 'type': 'str'}, + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'database_type': {'key': 'databaseType', 'type': 'str'}, + 'high_availability_type': {'key': 'highAvailabilityType', 'type': 'str'}, + } + + def __init__( + self, + *, + app_location: str, + environment: Union[str, "SAPEnvironmentType"], + sap_product: Union[str, "SAPProductType"], + deployment_type: Union[str, "SAPDeploymentType"], + database_type: Union[str, "SAPDatabaseType"], + high_availability_type: Optional[Union[str, "SAPHighAvailabilityType"]] = None, + **kwargs + ): + """ + :keyword app_location: Required. The geo-location where the resource is to be created. + :paramtype app_location: str + :keyword environment: Required. Defines the environment type - Production/Non Production. + Possible values include: "NonProd", "Prod". + :paramtype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType + :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :keyword deployment_type: Required. The deployment type. Eg: SingleServer/ThreeTier. Possible + values include: "SingleServer", "ThreeTier". + :paramtype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :keyword database_type: Required. The database type. Eg: HANA, DB2, etc. Possible values + include: "HANA", "DB2". + :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :keyword high_availability_type: The high availability type. Possible values include: + "AvailabilitySet", "AvailabilityZone". + :paramtype high_availability_type: str or ~azure.mgmt.workloads.models.SAPHighAvailabilityType + """ + super(SAPSupportedSkusRequest, self).__init__(**kwargs) + self.app_location = app_location + self.environment = environment + self.sap_product = sap_product + self.deployment_type = deployment_type + self.database_type = database_type + self.high_availability_type = high_availability_type + + +class SAPVirtualInstance(TrackedResource): + """Define the Virtual Instance for SAP. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Managed service identity (user assigned identities). + :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + :ivar environment: Required. Defines the environment type - Production/Non Production. Possible + values include: "NonProd", "Prod". + :vartype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType + :ivar sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :vartype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :ivar configuration: Required. Defines if an existing SAP system is being registered or a new + SAP system is being created. + :vartype configuration: ~azure.mgmt.workloads.models.SAPConfiguration + :ivar managed_resource_group_configuration: Managed resource group configuration. + :vartype managed_resource_group_configuration: + ~azure.mgmt.workloads.models.ManagedRGConfiguration + :ivar status: Defines the SAP Instance status. Possible values include: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable". + :vartype status: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceStatus + :ivar health: Defines the SAP Instance health. Possible values include: "Unknown", "Healthy", + "Unhealthy", "Degraded". + :vartype health: str or ~azure.mgmt.workloads.models.SAPHealthState + :ivar state: Defines the Virtual Instance for SAP state. Possible values include: + "InfrastructureDeploymentPending", "InfrastructureDeploymentInProgress", + "InfrastructureDeploymentFailed", "SoftwareInstallationPending", + "SoftwareInstallationInProgress", "SoftwareInstallationFailed", "DiscoveryPending", + "DiscoveryInProgress", "DiscoveryFailed", "RegistrationComplete". + :vartype state: str or ~azure.mgmt.workloads.models.SAPVirtualInstanceState + :ivar provisioning_state: Defines the provisioning states. Possible values include: + "Succeeded", "Updating", "Creating", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.workloads.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the Virtual Instance for SAP errors. + :vartype errors: ~azure.mgmt.workloads.models.SAPVirtualInstanceError + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'environment': {'required': True}, + 'sap_product': {'required': True}, + 'configuration': {'required': True}, + 'status': {'readonly': True}, + 'health': {'readonly': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'errors': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedServiceIdentity'}, + 'environment': {'key': 'properties.environment', 'type': 'str'}, + 'sap_product': {'key': 'properties.sapProduct', 'type': 'str'}, + 'configuration': {'key': 'properties.configuration', 'type': 'SAPConfiguration'}, + 'managed_resource_group_configuration': {'key': 'properties.managedResourceGroupConfiguration', 'type': 'ManagedRGConfiguration'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'health': {'key': 'properties.health', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'errors': {'key': 'properties.errors', 'type': 'SAPVirtualInstanceError'}, + } + + def __init__( + self, + *, + location: str, + environment: Union[str, "SAPEnvironmentType"], + sap_product: Union[str, "SAPProductType"], + configuration: "SAPConfiguration", + tags: Optional[Dict[str, str]] = None, + identity: Optional["UserAssignedServiceIdentity"] = None, + managed_resource_group_configuration: Optional["ManagedRGConfiguration"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Managed service identity (user assigned identities). + :paramtype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + :keyword environment: Required. Defines the environment type - Production/Non Production. + Possible values include: "NonProd", "Prod". + :paramtype environment: str or ~azure.mgmt.workloads.models.SAPEnvironmentType + :keyword sap_product: Required. Defines the SAP Product type. Possible values include: "ECC", + "S4HANA", "Other". + :paramtype sap_product: str or ~azure.mgmt.workloads.models.SAPProductType + :keyword configuration: Required. Defines if an existing SAP system is being registered or a + new SAP system is being created. + :paramtype configuration: ~azure.mgmt.workloads.models.SAPConfiguration + :keyword managed_resource_group_configuration: Managed resource group configuration. + :paramtype managed_resource_group_configuration: + ~azure.mgmt.workloads.models.ManagedRGConfiguration + """ + super(SAPVirtualInstance, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.environment = environment + self.sap_product = sap_product + self.configuration = configuration + self.managed_resource_group_configuration = managed_resource_group_configuration + self.status = None + self.health = None + self.state = None + self.provisioning_state = None + self.errors = None + + +class SAPVirtualInstanceError(msrest.serialization.Model): + """An error response from the Virtual Instance for SAP Workload service. + + :ivar properties: The Virtual Instance for SAP error body. + :vartype properties: ~azure.mgmt.workloads.models.ErrorDefinition + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + properties: Optional["ErrorDefinition"] = None, + **kwargs + ): + """ + :keyword properties: The Virtual Instance for SAP error body. + :paramtype properties: ~azure.mgmt.workloads.models.ErrorDefinition + """ + super(SAPVirtualInstanceError, self).__init__(**kwargs) + self.properties = properties + + +class SAPVirtualInstanceList(msrest.serialization.Model): + """Defines the collection of Virtual Instance for SAP. + + :ivar value: Gets the list of Virtual Instances for SAP. + :vartype value: list[~azure.mgmt.workloads.models.SAPVirtualInstance] + :ivar next_link: Gets the value of next link. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SAPVirtualInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SAPVirtualInstance"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Gets the list of Virtual Instances for SAP. + :paramtype value: list[~azure.mgmt.workloads.models.SAPVirtualInstance] + :keyword next_link: Gets the value of next link. + :paramtype next_link: str + """ + super(SAPVirtualInstanceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SearchProfile(NodeProfile): + """Search profile. + + 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 name: VM or VMSS name. + :vartype name: str + :ivar node_sku: Required. VM SKU for node(s). + :vartype node_sku: str + :ivar os_image: Required. OS image used for creating the nodes. + :vartype os_image: ~azure.mgmt.workloads.models.OsImageProfile + :ivar os_disk: Required. OS disk details. + :vartype os_disk: ~azure.mgmt.workloads.models.DiskInfo + :ivar data_disks: Data disks details. This property is not in use right now. + :vartype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] + :ivar node_resource_ids: VM/VMSS resource ARM Ids. + :vartype node_resource_ids: list[str] + :ivar search_type: Required. Search type. Possible values include: "Elastic". + :vartype search_type: str or ~azure.mgmt.workloads.models.SearchType + """ + + _validation = { + 'node_sku': {'required': True}, + 'os_image': {'required': True}, + 'os_disk': {'required': True}, + 'node_resource_ids': {'readonly': True}, + 'search_type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'node_sku': {'key': 'nodeSku', 'type': 'str'}, + 'os_image': {'key': 'osImage', 'type': 'OsImageProfile'}, + 'os_disk': {'key': 'osDisk', 'type': 'DiskInfo'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DiskInfo]'}, + 'node_resource_ids': {'key': 'nodeResourceIds', 'type': '[str]'}, + 'search_type': {'key': 'searchType', 'type': 'str'}, + } + + def __init__( + self, + *, + node_sku: str, + os_image: "OsImageProfile", + os_disk: "DiskInfo", + search_type: Union[str, "SearchType"], + name: Optional[str] = None, + data_disks: Optional[List["DiskInfo"]] = None, + **kwargs + ): + """ + :keyword name: VM or VMSS name. + :paramtype name: str + :keyword node_sku: Required. VM SKU for node(s). + :paramtype node_sku: str + :keyword os_image: Required. OS image used for creating the nodes. + :paramtype os_image: ~azure.mgmt.workloads.models.OsImageProfile + :keyword os_disk: Required. OS disk details. + :paramtype os_disk: ~azure.mgmt.workloads.models.DiskInfo + :keyword data_disks: Data disks details. This property is not in use right now. + :paramtype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] + :keyword search_type: Required. Search type. Possible values include: "Elastic". + :paramtype search_type: str or ~azure.mgmt.workloads.models.SearchType + """ + super(SearchProfile, self).__init__(name=name, node_sku=node_sku, os_image=os_image, os_disk=os_disk, data_disks=data_disks, **kwargs) + self.search_type = search_type + + +class ServiceInitiatedSoftwareConfiguration(SoftwareConfiguration): + """The SAP Software configuration Input when the software is to be installed by service. + + All required parameters must be populated in order to send to Azure. + + :ivar software_installation_type: Required. The SAP software installation Type.Constant filled + by server. Possible values include: "ServiceInitiated", "SAPInstallWithoutOSConfig". + :vartype software_installation_type: str or + ~azure.mgmt.workloads.models.SAPSoftwareInstallationType + :ivar bom_url: Required. The URL to the SAP Build of Materials(BOM) file. + :vartype bom_url: str + :ivar software_version: Required. The software version to install. + :vartype software_version: str + :ivar sap_bits_storage_account_id: Required. The SAP bits storage account id. + :vartype sap_bits_storage_account_id: str + :ivar sap_fqdn: Required. The FQDN to set for the SAP system during install. + :vartype sap_fqdn: str + :ivar ssh_private_key: Required. The SSH private key. + :vartype ssh_private_key: str + :ivar high_availability_software_configuration: Gets or sets the HA software configuration. + :vartype high_availability_software_configuration: + ~azure.mgmt.workloads.models.HighAvailabilitySoftwareConfiguration + """ + + _validation = { + 'software_installation_type': {'required': True}, + 'bom_url': {'required': True}, + 'software_version': {'required': True}, + 'sap_bits_storage_account_id': {'required': True}, + 'sap_fqdn': {'required': True}, + 'ssh_private_key': {'required': True}, + } + + _attribute_map = { + 'software_installation_type': {'key': 'softwareInstallationType', 'type': 'str'}, + 'bom_url': {'key': 'bomUrl', 'type': 'str'}, + 'software_version': {'key': 'softwareVersion', 'type': 'str'}, + 'sap_bits_storage_account_id': {'key': 'sapBitsStorageAccountId', 'type': 'str'}, + 'sap_fqdn': {'key': 'sapFqdn', 'type': 'str'}, + 'ssh_private_key': {'key': 'sshPrivateKey', 'type': 'str'}, + 'high_availability_software_configuration': {'key': 'highAvailabilitySoftwareConfiguration', 'type': 'HighAvailabilitySoftwareConfiguration'}, + } + + def __init__( + self, + *, + bom_url: str, + software_version: str, + sap_bits_storage_account_id: str, + sap_fqdn: str, + ssh_private_key: str, + high_availability_software_configuration: Optional["HighAvailabilitySoftwareConfiguration"] = None, + **kwargs + ): + """ + :keyword bom_url: Required. The URL to the SAP Build of Materials(BOM) file. + :paramtype bom_url: str + :keyword software_version: Required. The software version to install. + :paramtype software_version: str + :keyword sap_bits_storage_account_id: Required. The SAP bits storage account id. + :paramtype sap_bits_storage_account_id: str + :keyword sap_fqdn: Required. The FQDN to set for the SAP system during install. + :paramtype sap_fqdn: str + :keyword ssh_private_key: Required. The SSH private key. + :paramtype ssh_private_key: str + :keyword high_availability_software_configuration: Gets or sets the HA software configuration. + :paramtype high_availability_software_configuration: + ~azure.mgmt.workloads.models.HighAvailabilitySoftwareConfiguration + """ + super(ServiceInitiatedSoftwareConfiguration, self).__init__(**kwargs) + self.software_installation_type = 'ServiceInitiated' # type: str + self.bom_url = bom_url + self.software_version = software_version + self.sap_bits_storage_account_id = sap_bits_storage_account_id + self.sap_fqdn = sap_fqdn + self.ssh_private_key = ssh_private_key + self.high_availability_software_configuration = high_availability_software_configuration + + +class SingleServerConfiguration(InfrastructureConfiguration): + """Gets or sets the single server configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values + include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar app_resource_group: Required. The application resource group where SAP system resources + will be deployed. + :vartype app_resource_group: str + :ivar network_configuration: Network configuration for the server. + :vartype network_configuration: ~azure.mgmt.workloads.models.NetworkConfiguration + :ivar database_type: The database type. Possible values include: "HANA", "DB2". + :vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :ivar subnet_id: Required. The subnet id. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Required. Gets or sets the virtual machine configuration. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloads.models.VirtualMachineConfiguration + """ + + _validation = { + 'deployment_type': {'required': True}, + 'app_resource_group': {'required': True}, + 'subnet_id': {'required': True}, + 'virtual_machine_configuration': {'required': True}, + } + + _attribute_map = { + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'app_resource_group': {'key': 'appResourceGroup', 'type': 'str'}, + 'network_configuration': {'key': 'networkConfiguration', 'type': 'NetworkConfiguration'}, + 'database_type': {'key': 'databaseType', 'type': 'str'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'virtual_machine_configuration': {'key': 'virtualMachineConfiguration', 'type': 'VirtualMachineConfiguration'}, + } + + def __init__( + self, + *, + app_resource_group: str, + subnet_id: str, + virtual_machine_configuration: "VirtualMachineConfiguration", + network_configuration: Optional["NetworkConfiguration"] = None, + database_type: Optional[Union[str, "SAPDatabaseType"]] = None, + **kwargs + ): + """ + :keyword app_resource_group: Required. The application resource group where SAP system + resources will be deployed. + :paramtype app_resource_group: str + :keyword network_configuration: Network configuration for the server. + :paramtype network_configuration: ~azure.mgmt.workloads.models.NetworkConfiguration + :keyword database_type: The database type. Possible values include: "HANA", "DB2". + :paramtype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType + :keyword subnet_id: Required. The subnet id. + :paramtype subnet_id: str + :keyword virtual_machine_configuration: Required. Gets or sets the virtual machine + configuration. + :paramtype virtual_machine_configuration: + ~azure.mgmt.workloads.models.VirtualMachineConfiguration + """ + super(SingleServerConfiguration, self).__init__(app_resource_group=app_resource_group, **kwargs) + self.deployment_type = 'SingleServer' # type: str + self.network_configuration = network_configuration + self.database_type = database_type + self.subnet_id = subnet_id + self.virtual_machine_configuration = virtual_machine_configuration + + +class SingleServerRecommendationResult(SAPSizingRecommendationResult): + """The recommended configuration for a single server SAP system. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values + include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar vm_sku: The recommended VM SKU for single server. + :vartype vm_sku: str + """ + + _validation = { + 'deployment_type': {'required': True}, + } + + _attribute_map = { + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'vm_sku': {'key': 'vmSku', 'type': 'str'}, + } + + def __init__( + self, + *, + vm_sku: Optional[str] = None, + **kwargs + ): + """ + :keyword vm_sku: The recommended VM SKU for single server. + :paramtype vm_sku: str + """ + super(SingleServerRecommendationResult, self).__init__(**kwargs) + self.deployment_type = 'SingleServer' # type: str + self.vm_sku = vm_sku + + +class SiteProfile(msrest.serialization.Model): + """Workload website profile. + + :ivar domain_name: Domain name for the application site URL. + :vartype domain_name: str + """ + + _attribute_map = { + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + **kwargs + ): + """ + :keyword domain_name: Domain name for the application site URL. + :paramtype domain_name: str + """ + super(SiteProfile, self).__init__(**kwargs) + self.domain_name = domain_name + + +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :vartype name: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :vartype tier: str or ~azure.mgmt.workloads.models.SkuTier + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: str, + tier: Optional[Union[str, "SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :paramtype name: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.workloads.models.SkuTier + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + """ + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity + + +class SkuCapability(msrest.serialization.Model): + """The SKU capability definition. + + :ivar name: The capability name. + :vartype name: str + :ivar value: The capability value. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The capability name. + :paramtype name: str + :keyword value: The capability value. + :paramtype value: str + """ + super(SkuCapability, self).__init__(**kwargs) + self.name = name + self.value = value + + +class SkuCapacity(msrest.serialization.Model): + """The SKU capacity. + + :ivar minimum: Minimum capacity value. + :vartype minimum: int + :ivar maximum: Maximum capacity value. + :vartype maximum: int + :ivar default: Default capacity value. + :vartype default: int + :ivar scale_type: Scale type of the SKU capacity. Possible values include: "None", "Manual", + "Automatic". + :vartype scale_type: str or ~azure.mgmt.workloads.models.SkuScaleType + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + *, + minimum: Optional[int] = None, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "SkuScaleType"]] = None, + **kwargs + ): + """ + :keyword minimum: Minimum capacity value. + :paramtype minimum: int + :keyword maximum: Maximum capacity value. + :paramtype maximum: int + :keyword default: Default capacity value. + :paramtype default: int + :keyword scale_type: Scale type of the SKU capacity. Possible values include: "None", "Manual", + "Automatic". + :paramtype scale_type: str or ~azure.mgmt.workloads.models.SkuScaleType + """ + super(SkuCapacity, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.default = default + self.scale_type = scale_type + + +class SkuCost(msrest.serialization.Model): + """The SKU cost definition. + + :ivar meter_id: Billing meter id. + :vartype meter_id: str + :ivar quantity: The quantity. + :vartype quantity: int + :ivar extended_unit: The extended unit. + :vartype extended_unit: str + """ + + _attribute_map = { + 'meter_id': {'key': 'meterId', 'type': 'str'}, + 'quantity': {'key': 'quantity', 'type': 'int'}, + 'extended_unit': {'key': 'extendedUnit', 'type': 'str'}, + } + + def __init__( + self, + *, + meter_id: Optional[str] = None, + quantity: Optional[int] = None, + extended_unit: Optional[str] = None, + **kwargs + ): + """ + :keyword meter_id: Billing meter id. + :paramtype meter_id: str + :keyword quantity: The quantity. + :paramtype quantity: int + :keyword extended_unit: The extended unit. + :paramtype extended_unit: str + """ + super(SkuCost, self).__init__(**kwargs) + self.meter_id = meter_id + self.quantity = quantity + self.extended_unit = extended_unit + + +class SkuDefinition(msrest.serialization.Model): + """The SKU definition. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the SKU. + :vartype name: str + :ivar resource_type: Resource type the SKU applicable for. + :vartype resource_type: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. + :vartype tier: str + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar kind: If the service has different kinds of hardware, for the same SKU, then that can be + captured here. + :vartype kind: str + :ivar locations: List of locations where this SKU is available. + :vartype locations: list[str] + :ivar location_info: List of locations where this SKU is available. + :vartype location_info: list[~azure.mgmt.workloads.models.SkuLocationAndZones] + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: any + :ivar costs: The SKU costs. + :vartype costs: list[~azure.mgmt.workloads.models.SkuCost] + :ivar capabilities: The SKU capabilities. + :vartype capabilities: list[~azure.mgmt.workloads.models.SkuCapability] + :ivar restrictions: The SKU restrictions. + :vartype restrictions: list[~azure.mgmt.workloads.models.SkuRestriction] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationAndZones]'}, + 'capacity': {'key': 'capacity', 'type': 'object'}, + 'costs': {'key': 'costs', 'type': '[SkuCost]'}, + 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, + 'restrictions': {'key': 'restrictions', 'type': '[SkuRestriction]'}, + } + + def __init__( + self, + *, + name: str, + resource_type: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + kind: Optional[str] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["SkuLocationAndZones"]] = None, + capacity: Optional[Any] = None, + costs: Optional[List["SkuCost"]] = None, + capabilities: Optional[List["SkuCapability"]] = None, + restrictions: Optional[List["SkuRestriction"]] = None, + **kwargs + ): + """ + :keyword name: Required. The name of the SKU. + :paramtype name: str + :keyword resource_type: Resource type the SKU applicable for. + :paramtype resource_type: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. + :paramtype tier: str + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword kind: If the service has different kinds of hardware, for the same SKU, then that can + be captured here. + :paramtype kind: str + :keyword locations: List of locations where this SKU is available. + :paramtype locations: list[str] + :keyword location_info: List of locations where this SKU is available. + :paramtype location_info: list[~azure.mgmt.workloads.models.SkuLocationAndZones] + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: any + :keyword costs: The SKU costs. + :paramtype costs: list[~azure.mgmt.workloads.models.SkuCost] + :keyword capabilities: The SKU capabilities. + :paramtype capabilities: list[~azure.mgmt.workloads.models.SkuCapability] + :keyword restrictions: The SKU restrictions. + :paramtype restrictions: list[~azure.mgmt.workloads.models.SkuRestriction] + """ + super(SkuDefinition, self).__init__(**kwargs) + self.name = name + self.resource_type = resource_type + self.tier = tier + self.size = size + self.family = family + self.kind = kind + self.locations = locations + self.location_info = location_info + self.capacity = capacity + self.costs = costs + self.capabilities = capabilities + self.restrictions = restrictions + + +class SkuLocationAndZones(msrest.serialization.Model): + """The SKU location and zone. + + :ivar location: The location of the SKU. + :vartype location: str + :ivar zones: The availability zones of SKU location. + :vartype zones: list[str] + :ivar zone_details: The availability zone details of the SKU location. + :vartype zone_details: list[~azure.mgmt.workloads.models.SkuZoneDetail] + :ivar extended_locations: The extended locations of SKU. + :vartype extended_locations: list[str] + :ivar type: Type of the extended location. Possible values include: "Region", "EdgeZone". + :vartype type: str or ~azure.mgmt.workloads.models.LocationType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'zone_details': {'key': 'zoneDetails', 'type': '[SkuZoneDetail]'}, + 'extended_locations': {'key': 'extendedLocations', 'type': '[str]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["SkuZoneDetail"]] = None, + extended_locations: Optional[List[str]] = None, + type: Optional[Union[str, "LocationType"]] = None, + **kwargs + ): + """ + :keyword location: The location of the SKU. + :paramtype location: str + :keyword zones: The availability zones of SKU location. + :paramtype zones: list[str] + :keyword zone_details: The availability zone details of the SKU location. + :paramtype zone_details: list[~azure.mgmt.workloads.models.SkuZoneDetail] + :keyword extended_locations: The extended locations of SKU. + :paramtype extended_locations: list[str] + :keyword type: Type of the extended location. Possible values include: "Region", "EdgeZone". + :paramtype type: str or ~azure.mgmt.workloads.models.LocationType + """ + super(SkuLocationAndZones, self).__init__(**kwargs) + self.location = location + self.zones = zones + self.zone_details = zone_details + self.extended_locations = extended_locations + self.type = type + + +class SkuRestriction(msrest.serialization.Model): + """The SKU restriction definition. + + :ivar type: The SKU restriction type. Possible values include: "NotSpecified", "Location", + "Zone". + :vartype type: str or ~azure.mgmt.workloads.models.SkuRestrictionType + :ivar values: Restriction values. + :vartype values: list[str] + :ivar restriction_info: The restriction information. + :vartype restriction_info: any + :ivar reason_code: The SKU restriction reason code. Possible values include: "NotSpecified", + "QuotaId", "NotAvailableForSubscription". + :vartype reason_code: str or ~azure.mgmt.workloads.models.SkuRestrictionReasonCode + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + 'restriction_info': {'key': 'restrictionInfo', 'type': 'object'}, + 'reason_code': {'key': 'reasonCode', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "SkuRestrictionType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional[Any] = None, + reason_code: Optional[Union[str, "SkuRestrictionReasonCode"]] = None, + **kwargs + ): + """ + :keyword type: The SKU restriction type. Possible values include: "NotSpecified", "Location", + "Zone". + :paramtype type: str or ~azure.mgmt.workloads.models.SkuRestrictionType + :keyword values: Restriction values. + :paramtype values: list[str] + :keyword restriction_info: The restriction information. + :paramtype restriction_info: any + :keyword reason_code: The SKU restriction reason code. Possible values include: "NotSpecified", + "QuotaId", "NotAvailableForSubscription". + :paramtype reason_code: str or ~azure.mgmt.workloads.models.SkuRestrictionReasonCode + """ + super(SkuRestriction, self).__init__(**kwargs) + self.type = type + self.values = values + self.restriction_info = restriction_info + self.reason_code = reason_code + + +class SkusListResult(msrest.serialization.Model): + """A list of SKUs supported by an Azure Resource Provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SKUs supported by the resource provider. + :vartype value: list[~azure.mgmt.workloads.models.SkuDefinition] + :ivar next_link: URL to get the next set of SKU list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SkusListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SkuZoneDetail(msrest.serialization.Model): + """The SKU zone details. + + :ivar zones: The physical zones. + :vartype zones: list[str] + :ivar capabilities: The capabilities. + :vartype capabilities: list[~azure.mgmt.workloads.models.SkuCapability] + """ + + _attribute_map = { + 'zones': {'key': 'zones', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, + } + + def __init__( + self, + *, + zones: Optional[List[str]] = None, + capabilities: Optional[List["SkuCapability"]] = None, + **kwargs + ): + """ + :keyword zones: The physical zones. + :paramtype zones: list[str] + :keyword capabilities: The capabilities. + :paramtype capabilities: list[~azure.mgmt.workloads.models.SkuCapability] + """ + super(SkuZoneDetail, self).__init__(**kwargs) + self.zones = zones + self.capabilities = capabilities + + +class SshConfiguration(msrest.serialization.Model): + """SSH configuration for Linux based VMs running on Azure. + + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.workloads.models.SshPublicKey] + """ + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[SshPublicKey]'}, + } + + def __init__( + self, + *, + public_keys: Optional[List["SshPublicKey"]] = None, + **kwargs + ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :paramtype public_keys: list[~azure.mgmt.workloads.models.SshPublicKey] + """ + super(SshConfiguration, self).__init__(**kwargs) + self.public_keys = public_keys + + +class SshKeyPair(msrest.serialization.Model): + """The SSH Key-pair used to authenticate with the VM. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure `_. + + :ivar public_key: SSH public key. + :vartype public_key: str + :ivar private_key: SSH private key. + :vartype private_key: str + """ + + _attribute_map = { + 'public_key': {'key': 'publicKey', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + } + + def __init__( + self, + *, + public_key: Optional[str] = None, + private_key: Optional[str] = None, + **kwargs + ): + """ + :keyword public_key: SSH public key. + :paramtype public_key: str + :keyword private_key: SSH private key. + :paramtype private_key: str + """ + super(SshKeyPair, self).__init__(**kwargs) + self.public_key = public_key + self.private_key = private_key + + +class SshPublicKey(msrest.serialization.Model): + """Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + + :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating + ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure + `_. + :vartype key_data: str + """ + + _attribute_map = { + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__( + self, + *, + key_data: Optional[str] = None, + **kwargs + ): + """ + :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For creating + ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure + `_. + :paramtype key_data: str + """ + super(SshPublicKey, self).__init__(**kwargs) + self.key_data = key_data + + +class StopRequest(msrest.serialization.Model): + """Stop SAP Request. + + :ivar hard_stop: A boolean to specify if the SAP system should be hard-stopped. + :vartype hard_stop: bool + """ + + _attribute_map = { + 'hard_stop': {'key': 'hardStop', 'type': 'bool'}, + } + + def __init__( + self, + *, + hard_stop: Optional[bool] = False, + **kwargs + ): + """ + :keyword hard_stop: A boolean to specify if the SAP system should be hard-stopped. + :paramtype hard_stop: bool + """ + super(StopRequest, self).__init__(**kwargs) + self.hard_stop = hard_stop + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.workloads.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.workloads.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype 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 + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.workloads.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.workloads.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + 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 Tags(msrest.serialization.Model): + """Tags field of the resource. + + :ivar tags: A set of tags. Tags field of the resource. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Tags field of the resource. + :paramtype tags: dict[str, str] + """ + super(Tags, self).__init__(**kwargs) + self.tags = tags + + +class ThreeTierConfiguration(InfrastructureConfiguration): + """Gets or sets the three tier SAP configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values + include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar app_resource_group: Required. The application resource group where SAP system resources + will be deployed. + :vartype app_resource_group: str + :ivar network_configuration: Network configuration common to all servers. + :vartype network_configuration: ~azure.mgmt.workloads.models.NetworkConfiguration + :ivar central_server: Required. The central server configuration. + :vartype central_server: ~azure.mgmt.workloads.models.CentralServerConfiguration + :ivar application_server: Required. The application server configuration. + :vartype application_server: ~azure.mgmt.workloads.models.ApplicationServerConfiguration + :ivar database_server: Required. The database configuration. + :vartype database_server: ~azure.mgmt.workloads.models.DatabaseConfiguration + :ivar high_availability_config: The high availability configuration. + :vartype high_availability_config: ~azure.mgmt.workloads.models.HighAvailabilityConfiguration + """ + + _validation = { + 'deployment_type': {'required': True}, + 'app_resource_group': {'required': True}, + 'central_server': {'required': True}, + 'application_server': {'required': True}, + 'database_server': {'required': True}, + } + + _attribute_map = { + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'app_resource_group': {'key': 'appResourceGroup', 'type': 'str'}, + 'network_configuration': {'key': 'networkConfiguration', 'type': 'NetworkConfiguration'}, + 'central_server': {'key': 'centralServer', 'type': 'CentralServerConfiguration'}, + 'application_server': {'key': 'applicationServer', 'type': 'ApplicationServerConfiguration'}, + 'database_server': {'key': 'databaseServer', 'type': 'DatabaseConfiguration'}, + 'high_availability_config': {'key': 'highAvailabilityConfig', 'type': 'HighAvailabilityConfiguration'}, + } + + def __init__( + self, + *, + app_resource_group: str, + central_server: "CentralServerConfiguration", + application_server: "ApplicationServerConfiguration", + database_server: "DatabaseConfiguration", + network_configuration: Optional["NetworkConfiguration"] = None, + high_availability_config: Optional["HighAvailabilityConfiguration"] = None, + **kwargs + ): + """ + :keyword app_resource_group: Required. The application resource group where SAP system + resources will be deployed. + :paramtype app_resource_group: str + :keyword network_configuration: Network configuration common to all servers. + :paramtype network_configuration: ~azure.mgmt.workloads.models.NetworkConfiguration + :keyword central_server: Required. The central server configuration. + :paramtype central_server: ~azure.mgmt.workloads.models.CentralServerConfiguration + :keyword application_server: Required. The application server configuration. + :paramtype application_server: ~azure.mgmt.workloads.models.ApplicationServerConfiguration + :keyword database_server: Required. The database configuration. + :paramtype database_server: ~azure.mgmt.workloads.models.DatabaseConfiguration + :keyword high_availability_config: The high availability configuration. + :paramtype high_availability_config: ~azure.mgmt.workloads.models.HighAvailabilityConfiguration + """ + super(ThreeTierConfiguration, self).__init__(app_resource_group=app_resource_group, **kwargs) + self.deployment_type = 'ThreeTier' # type: str + self.network_configuration = network_configuration + self.central_server = central_server + self.application_server = application_server + self.database_server = database_server + self.high_availability_config = high_availability_config + + +class ThreeTierRecommendationResult(SAPSizingRecommendationResult): + """The recommended configuration for a three tier SAP system. + + All required parameters must be populated in order to send to Azure. + + :ivar deployment_type: Required. The deployment Type.Constant filled by server. Possible values + include: "SingleServer", "ThreeTier". + :vartype deployment_type: str or ~azure.mgmt.workloads.models.SAPDeploymentType + :ivar db_vm_sku: The database VM SKU. + :vartype db_vm_sku: str + :ivar database_instance_count: The database server instance count. + :vartype database_instance_count: long + :ivar central_server_vm_sku: The central server VM SKU. + :vartype central_server_vm_sku: str + :ivar central_server_instance_count: The central server instance count. + :vartype central_server_instance_count: long + :ivar application_server_vm_sku: The application server VM SKU. + :vartype application_server_vm_sku: str + :ivar application_server_instance_count: The application server instance count. + :vartype application_server_instance_count: long + """ + + _validation = { + 'deployment_type': {'required': True}, + } + + _attribute_map = { + 'deployment_type': {'key': 'deploymentType', 'type': 'str'}, + 'db_vm_sku': {'key': 'dbVmSku', 'type': 'str'}, + 'database_instance_count': {'key': 'databaseInstanceCount', 'type': 'long'}, + 'central_server_vm_sku': {'key': 'centralServerVmSku', 'type': 'str'}, + 'central_server_instance_count': {'key': 'centralServerInstanceCount', 'type': 'long'}, + 'application_server_vm_sku': {'key': 'applicationServerVmSku', 'type': 'str'}, + 'application_server_instance_count': {'key': 'applicationServerInstanceCount', 'type': 'long'}, + } + + def __init__( + self, + *, + db_vm_sku: Optional[str] = None, + database_instance_count: Optional[int] = None, + central_server_vm_sku: Optional[str] = None, + central_server_instance_count: Optional[int] = None, + application_server_vm_sku: Optional[str] = None, + application_server_instance_count: Optional[int] = None, + **kwargs + ): + """ + :keyword db_vm_sku: The database VM SKU. + :paramtype db_vm_sku: str + :keyword database_instance_count: The database server instance count. + :paramtype database_instance_count: long + :keyword central_server_vm_sku: The central server VM SKU. + :paramtype central_server_vm_sku: str + :keyword central_server_instance_count: The central server instance count. + :paramtype central_server_instance_count: long + :keyword application_server_vm_sku: The application server VM SKU. + :paramtype application_server_vm_sku: str + :keyword application_server_instance_count: The application server instance count. + :paramtype application_server_instance_count: long + """ + super(ThreeTierRecommendationResult, self).__init__(**kwargs) + self.deployment_type = 'ThreeTier' # type: str + self.db_vm_sku = db_vm_sku + self.database_instance_count = database_instance_count + self.central_server_vm_sku = central_server_vm_sku + self.central_server_instance_count = central_server_instance_count + self.application_server_vm_sku = application_server_vm_sku + self.application_server_instance_count = application_server_instance_count + + +class UpdateMonitorRequest(msrest.serialization.Model): + """Defines the request body for updating SAP monitor resource. + + :ivar tags: A set of tags. Gets or sets the Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (user assigned identities). + :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedServiceIdentity'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["UserAssignedServiceIdentity"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (user assigned identities). + :paramtype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + """ + super(UpdateMonitorRequest, self).__init__(**kwargs) + self.tags = tags + self.identity = identity + + +class UpdateSAPApplicationInstanceRequest(msrest.serialization.Model): + """Defines the request body for updating SAP Application Instance. + + :ivar tags: A set of tags. Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + """ + super(UpdateSAPApplicationInstanceRequest, self).__init__(**kwargs) + self.tags = tags + + +class UpdateSAPCentralInstanceRequest(msrest.serialization.Model): + """Defines the request body for updating SAP Central Instance. + + :ivar tags: A set of tags. Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + """ + super(UpdateSAPCentralInstanceRequest, self).__init__(**kwargs) + self.tags = tags + + +class UpdateSAPDatabaseInstanceRequest(msrest.serialization.Model): + """Defines the request body for updating SAP Database Instance. + + :ivar tags: A set of tags. Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + """ + super(UpdateSAPDatabaseInstanceRequest, self).__init__(**kwargs) + self.tags = tags + + +class UpdateSAPVirtualInstanceRequest(msrest.serialization.Model): + """Defines the request body for updating Virtual Instance for SAP. + + :ivar tags: A set of tags. Gets or sets the Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (user assigned identities). + :vartype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedServiceIdentity'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["UserAssignedServiceIdentity"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Gets or sets the Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (user assigned identities). + :paramtype identity: ~azure.mgmt.workloads.models.UserAssignedServiceIdentity + """ + super(UpdateSAPVirtualInstanceRequest, self).__init__(**kwargs) + self.tags = tags + self.identity = identity + + +class UserAssignedIdentity(msrest.serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class UserProfile(msrest.serialization.Model): + """User profile to configure on a compute resources such as VM, VMSS. + + All required parameters must be populated in order to send to Azure. + + :ivar user_name: Required. User name. + :vartype user_name: str + :ivar ssh_public_key: Required. SSH public key data. + :vartype ssh_public_key: str + """ + + _validation = { + 'user_name': {'required': True}, + 'ssh_public_key': {'required': True}, + } + + _attribute_map = { + 'user_name': {'key': 'userName', 'type': 'str'}, + 'ssh_public_key': {'key': 'sshPublicKey', 'type': 'str'}, + } + + def __init__( + self, + *, + user_name: str, + ssh_public_key: str, + **kwargs + ): + """ + :keyword user_name: Required. User name. + :paramtype user_name: str + :keyword ssh_public_key: Required. SSH public key data. + :paramtype ssh_public_key: str + """ + super(UserProfile, self).__init__(**kwargs) + self.user_name = user_name + self.ssh_public_key = ssh_public_key + + +class VirtualMachineConfiguration(msrest.serialization.Model): + """Defines the virtual machine configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar vm_size: Required. The virtual machine size. + :vartype vm_size: str + :ivar image_reference: Required. The image reference. + :vartype image_reference: ~azure.mgmt.workloads.models.ImageReference + :ivar os_profile: Required. The OS profile. + :vartype os_profile: ~azure.mgmt.workloads.models.OSProfile + """ + + _validation = { + 'vm_size': {'required': True}, + 'image_reference': {'required': True}, + 'os_profile': {'required': True}, + } + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_profile': {'key': 'osProfile', 'type': 'OSProfile'}, + } + + def __init__( + self, + *, + vm_size: str, + image_reference: "ImageReference", + os_profile: "OSProfile", + **kwargs + ): + """ + :keyword vm_size: Required. The virtual machine size. + :paramtype vm_size: str + :keyword image_reference: Required. The image reference. + :paramtype image_reference: ~azure.mgmt.workloads.models.ImageReference + :keyword os_profile: Required. The OS profile. + :paramtype os_profile: ~azure.mgmt.workloads.models.OSProfile + """ + super(VirtualMachineConfiguration, self).__init__(**kwargs) + self.vm_size = vm_size + self.image_reference = image_reference + self.os_profile = os_profile + + +class VmssNodesProfile(NodeProfile): + """VMSS profile. + + 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 name: VM or VMSS name. + :vartype name: str + :ivar node_sku: Required. VM SKU for node(s). + :vartype node_sku: str + :ivar os_image: Required. OS image used for creating the nodes. + :vartype os_image: ~azure.mgmt.workloads.models.OsImageProfile + :ivar os_disk: Required. OS disk details. + :vartype os_disk: ~azure.mgmt.workloads.models.DiskInfo + :ivar data_disks: Data disks details. This property is not in use right now. + :vartype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] + :ivar node_resource_ids: VM/VMSS resource ARM Ids. + :vartype node_resource_ids: list[str] + :ivar auto_scale_min_count: Minimum number of nodes for autoscale. + :vartype auto_scale_min_count: int + :ivar auto_scale_max_count: Maximum number of nodes for autoscale. + :vartype auto_scale_max_count: int + """ + + _validation = { + 'node_sku': {'required': True}, + 'os_image': {'required': True}, + 'os_disk': {'required': True}, + 'node_resource_ids': {'readonly': True}, + 'auto_scale_min_count': {'minimum': 1}, + 'auto_scale_max_count': {'minimum': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'node_sku': {'key': 'nodeSku', 'type': 'str'}, + 'os_image': {'key': 'osImage', 'type': 'OsImageProfile'}, + 'os_disk': {'key': 'osDisk', 'type': 'DiskInfo'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DiskInfo]'}, + 'node_resource_ids': {'key': 'nodeResourceIds', 'type': '[str]'}, + 'auto_scale_min_count': {'key': 'autoScaleMinCount', 'type': 'int'}, + 'auto_scale_max_count': {'key': 'autoScaleMaxCount', 'type': 'int'}, + } + + def __init__( + self, + *, + node_sku: str, + os_image: "OsImageProfile", + os_disk: "DiskInfo", + name: Optional[str] = None, + data_disks: Optional[List["DiskInfo"]] = None, + auto_scale_min_count: Optional[int] = None, + auto_scale_max_count: Optional[int] = None, + **kwargs + ): + """ + :keyword name: VM or VMSS name. + :paramtype name: str + :keyword node_sku: Required. VM SKU for node(s). + :paramtype node_sku: str + :keyword os_image: Required. OS image used for creating the nodes. + :paramtype os_image: ~azure.mgmt.workloads.models.OsImageProfile + :keyword os_disk: Required. OS disk details. + :paramtype os_disk: ~azure.mgmt.workloads.models.DiskInfo + :keyword data_disks: Data disks details. This property is not in use right now. + :paramtype data_disks: list[~azure.mgmt.workloads.models.DiskInfo] + :keyword auto_scale_min_count: Minimum number of nodes for autoscale. + :paramtype auto_scale_min_count: int + :keyword auto_scale_max_count: Maximum number of nodes for autoscale. + :paramtype auto_scale_max_count: int + """ + super(VmssNodesProfile, self).__init__(name=name, node_sku=node_sku, os_image=os_image, os_disk=os_disk, data_disks=data_disks, **kwargs) + self.auto_scale_min_count = auto_scale_min_count + self.auto_scale_max_count = auto_scale_max_count + + +class WindowsConfiguration(OSConfiguration): + """Specifies Windows operating system settings on the virtual machine. + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: Required. The OS Type.Constant filled by server. Possible values include: + "Linux", "Windows". + :vartype os_type: str or ~azure.mgmt.workloads.models.OSType + """ + + _validation = { + 'os_type': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(WindowsConfiguration, self).__init__(**kwargs) + self.os_type = 'Windows' # type: str + + +class WordpressInstanceResource(ProxyResource): + """WordPress instance resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.workloads.models.SystemData + :ivar version: Application version. Possible values include: "5.4.3", "5.4.2", "5.4.1", "5.4". + :vartype version: str or ~azure.mgmt.workloads.models.WordpressVersions + :ivar database_name: Database name used by the application. + :vartype database_name: str + :ivar database_user: User name used by the application to connect to database. + :vartype database_user: str + :ivar site_url: Site Url to access the WordPress application. + :vartype site_url: str + :ivar provisioning_state: WordPress instance provisioning state. Possible values include: + "NotSpecified", "Accepted", "Created", "Succeeded", "Failed", "Canceled", "Installing". + :vartype provisioning_state: str or ~azure.mgmt.workloads.models.ApplicationProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'site_url': {'readonly': True}, + 'provisioning_state': {'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'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'database_user': {'key': 'properties.databaseUser', 'type': 'str'}, + 'site_url': {'key': 'properties.siteUrl', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[Union[str, "WordpressVersions"]] = None, + database_name: Optional[str] = None, + database_user: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Application version. Possible values include: "5.4.3", "5.4.2", "5.4.1", + "5.4". + :paramtype version: str or ~azure.mgmt.workloads.models.WordpressVersions + :keyword database_name: Database name used by the application. + :paramtype database_name: str + :keyword database_user: User name used by the application to connect to database. + :paramtype database_user: str + """ + super(WordpressInstanceResource, self).__init__(**kwargs) + self.version = version + self.database_name = database_name + self.database_user = database_user + self.site_url = None + self.provisioning_state = None + + +class WordpressInstanceResourceList(msrest.serialization.Model): + """WordPress instance resource list. + + :ivar value: List of resources in current page. + :vartype value: list[~azure.mgmt.workloads.models.WordpressInstanceResource] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WordpressInstanceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["WordpressInstanceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: List of resources in current page. + :paramtype value: list[~azure.mgmt.workloads.models.WordpressInstanceResource] + :keyword next_link: Link to next page of resources. + :paramtype next_link: str + """ + super(WordpressInstanceResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py new file mode 100644 index 000000000000..d405fdf30ca0 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_workloads_client_enums.py @@ -0,0 +1,407 @@ +# 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 +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class ApplicationProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """WordPress instance provisioning state + """ + + NOT_SPECIFIED = "NotSpecified" + ACCEPTED = "Accepted" + CREATED = "Created" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + INSTALLING = "Installing" + +class AzureFrontDoorEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether to enable Azure front door + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class CentralServerVirtualMachineType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the type of central server VM. + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + UNKNOWN = "Unknown" + ASCS = "ASCS" + ERS_INACTIVE = "ERSInactive" + ERS = "ERS" + STANDBY = "Standby" + +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 DatabaseTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Tier of the server SKU + """ + + BURSTABLE = "Burstable" + GENERAL_PURPOSE = "GeneralPurpose" + MEMORY_OPTIMIZED = "MemoryOptimized" + +class DatabaseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Database type + """ + + MY_SQL = "MySql" + +class DiskStorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Storage type + """ + + PREMIUM_LRS = "Premium_LRS" + STANDARD_LRS = "Standard_LRS" + STANDARD_SSD_LRS = "StandardSSD_LRS" + +class EnableBackup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether to enable Azure backup for the workload + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class EnableSslEnforcement(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether to enable SSL enforcement on the database + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class EnqueueReplicationServerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the type of Enqueue Replication Server. + """ + + ENQUEUE_REPLICATOR1 = "EnqueueReplicator1" + ENQUEUE_REPLICATOR2 = "EnqueueReplicator2" + +class FileShareStorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """File share backing storage type + """ + + STANDARD_LRS = "Standard_LRS" + STANDARD_GRS = "Standard_GRS" + STANDARD_ZRS = "Standard_ZRS" + PREMIUM_LRS = "Premium_LRS" + +class FileShareType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Share type + """ + + NFS_ON_CONTROLLER = "NfsOnController" + AZURE_FILES = "AzureFiles" + +class HAEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether to enable HA for the server + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class LoadBalancerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Load balancer type + """ + + APPLICATION_GATEWAY = "ApplicationGateway" + LOAD_BALANCER = "LoadBalancer" + +class LocationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the extended location. + """ + + REGION = "Region" + EDGE_ZONE = "EdgeZone" + +class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity (only None, UserAssigned types are allowed). + """ + + NONE = "None" + USER_ASSIGNED = "UserAssigned" + +class OperationProperties(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the workload operation origin. + """ + + NOT_SPECIFIED = "NotSpecified" + USER = "User" + SYSTEM = "System" + +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class OSImageOffer(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """OS image offer + """ + + UBUNTU_SERVER = "UbuntuServer" + +class OSImagePublisher(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """OS image publisher + """ + + CANONICAL = "Canonical" + +class OSImageSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """OS image sku + """ + + EIGHTEEN04_LTS = "18.04-LTS" + SIXTEEN04_LTS = "16.04-LTS" + +class OSImageVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """OS image version + """ + + LATEST = "latest" + +class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The OS Type + """ + + LINUX = "Linux" + WINDOWS = "Windows" + +class PHPVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """PHP version + """ + + SEVEN2 = "7.2" + SEVEN3 = "7.3" + SEVEN4 = "7.4" + +class PhpWorkloadProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Php workload resource provisioning state + """ + + NOT_SPECIFIED = "NotSpecified" + ACCEPTED = "Accepted" + CREATED = "Created" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + PROVISIONING = "Provisioning" + DELETING = "Deleting" + +class RedisCacheFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Cache family + """ + + C = "C" + P = "P" + +class RoutingPreference(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Sets the routing preference of the SAP monitor. By default only RFC1918 traffic is routed to + the customer VNET. + """ + + DEFAULT = "Default" + ROUTE_ALL = "RouteAll" + +class SAPConfigurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The configuration Type. + """ + + DEPLOYMENT = "Deployment" + DISCOVERY = "Discovery" + DEPLOYMENT_WITH_OS_CONFIG = "DeploymentWithOSConfig" + +class SAPDatabaseScaleMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The database scale method. + """ + + SCALE_UP = "ScaleUp" + +class SAPDatabaseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the supported SAP Database types. + """ + + HANA = "HANA" + DB2 = "DB2" + +class SAPDeploymentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The deployment Type. + """ + + SINGLE_SERVER = "SingleServer" + THREE_TIER = "ThreeTier" + +class SAPEnvironmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the environment type - Production/Non Production. + """ + + NON_PROD = "NonProd" + PROD = "Prod" + +class SAPHealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the SAP Instance health. + """ + + UNKNOWN = "Unknown" + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + DEGRADED = "Degraded" + +class SAPHighAvailabilityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The high availability Type. AvailabilitySet guarantees 99.95% availability. Availability Zone + guarantees 99.99% availability. + """ + + AVAILABILITY_SET = "AvailabilitySet" + AVAILABILITY_ZONE = "AvailabilityZone" + +class SAPProductType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the SAP Product type. + """ + + ECC = "ECC" + S4_HANA = "S4HANA" + OTHER = "Other" + +class SAPSoftwareInstallationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SAP software installation Type. + """ + + SERVICE_INITIATED = "ServiceInitiated" + SAP_INSTALL_WITHOUT_OS_CONFIG = "SAPInstallWithoutOSConfig" + +class SapVirtualInstanceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the provisioning states. + """ + + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + CREATING = "Creating" + FAILED = "Failed" + DELETING = "Deleting" + +class SAPVirtualInstanceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the Virtual Instance for SAP state. + """ + + INFRASTRUCTURE_DEPLOYMENT_PENDING = "InfrastructureDeploymentPending" + INFRASTRUCTURE_DEPLOYMENT_IN_PROGRESS = "InfrastructureDeploymentInProgress" + INFRASTRUCTURE_DEPLOYMENT_FAILED = "InfrastructureDeploymentFailed" + SOFTWARE_INSTALLATION_PENDING = "SoftwareInstallationPending" + SOFTWARE_INSTALLATION_IN_PROGRESS = "SoftwareInstallationInProgress" + SOFTWARE_INSTALLATION_FAILED = "SoftwareInstallationFailed" + DISCOVERY_PENDING = "DiscoveryPending" + DISCOVERY_IN_PROGRESS = "DiscoveryInProgress" + DISCOVERY_FAILED = "DiscoveryFailed" + REGISTRATION_COMPLETE = "RegistrationComplete" + +class SAPVirtualInstanceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the SAP Instance status. + """ + + STARTING = "Starting" + RUNNING = "Running" + STOPPING = "Stopping" + OFFLINE = "Offline" + PARTIALLY_RUNNING = "PartiallyRunning" + UNAVAILABLE = "Unavailable" + +class SearchType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Search type + """ + + ELASTIC = "Elastic" + +class SkuRestrictionReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SKU restriction reason code. + """ + + NOT_SPECIFIED = "NotSpecified" + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + +class SkuRestrictionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SKU restriction type. + """ + + NOT_SPECIFIED = "NotSpecified" + LOCATION = "Location" + ZONE = "Zone" + +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Scale type of the SKU capacity. + """ + + NONE = "None" + MANUAL = "Manual" + AUTOMATIC = "Automatic" + +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """This field is required to be implemented by the Resource Provider if the service has more than + one tier, but is not required on a PUT. + """ + + FREE = "Free" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class WordpressVersions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Application version + """ + + FIVE4_3 = "5.4.3" + FIVE4_2 = "5.4.2" + FIVE4_1 = "5.4.1" + FIVE4 = "5.4" + +class WorkloadKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates which kind of php workload this resource represent e.g WordPress + """ + + WORD_PRESS = "WordPress" + +class WorkloadMonitorActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the action type of workload operation. + """ + + NOT_SPECIFIED = "NotSpecified" + INTERNAL = "Internal" + +class WorkloadMonitorProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of provisioning of the SAP monitor. + """ + + ACCEPTED = "Accepted" + CREATING = "Creating" + UPDATING = "Updating" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + MIGRATING = "Migrating" diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py new file mode 100644 index 000000000000..776a9a684ec2 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._php_workloads_operations import PhpWorkloadsOperations +from ._wordpress_instances_operations import WordpressInstancesOperations +from ._workloads_client_operations import WorkloadsClientOperationsMixin +from ._sap_virtual_instances_operations import SAPVirtualInstancesOperations +from ._sap_central_instances_operations import SAPCentralInstancesOperations +from ._sap_database_instances_operations import SAPDatabaseInstancesOperations +from ._sap_application_server_instances_operations import SAPApplicationServerInstancesOperations +from ._operations import Operations +from ._monitors_operations import MonitorsOperations +from ._provider_instances_operations import ProviderInstancesOperations +from ._skus_operations import SkusOperations + +__all__ = [ + 'PhpWorkloadsOperations', + 'WordpressInstancesOperations', + 'WorkloadsClientOperationsMixin', + 'SAPVirtualInstancesOperations', + 'SAPCentralInstancesOperations', + 'SAPDatabaseInstancesOperations', + 'SAPApplicationServerInstancesOperations', + 'Operations', + 'MonitorsOperations', + 'ProviderInstancesOperations', + 'SkusOperations', +] diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py new file mode 100644 index 000000000000..c3ad9d62562e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py @@ -0,0 +1,806 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class MonitorsOperations(object): + """MonitorsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.MonitorListResult"]: + """Gets a list of SAP monitors in the specified subscription. + + Gets a list of SAP monitors in the specified subscription. The operations returns various + properties of each SAP monitor. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitorListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.MonitorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MonitorListResult", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/monitors"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitorListResult"]: + """Gets a list of SAP monitors. + + Gets a list of SAP monitors in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitorListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.MonitorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MonitorListResult", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/monitors"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.Monitor": + """Gets properties of a SAP monitor. + + Gets properties of a SAP monitor for the specified subscription, resource group, and resource + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Monitor, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.Monitor + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Monitor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + monitor_parameter: "_models.Monitor", + **kwargs: Any + ) -> "_models.Monitor": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitor_parameter, 'Monitor') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Monitor', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Monitor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + monitor_parameter: "_models.Monitor", + **kwargs: Any + ) -> LROPoller["_models.Monitor"]: + """Creates a SAP monitor. + + Creates a SAP monitor for the specified subscription, resource group, and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param monitor_parameter: Request body representing a SAP monitor. + :type monitor_parameter: ~azure.mgmt.workloads.models.Monitor + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Monitor or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.Monitor] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + 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, + monitor_name=monitor_name, + monitor_parameter=monitor_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Monitor', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResult"]: + """Deletes a SAP monitor. + + Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + monitor_name=monitor_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + monitor_name: str, + body: "_models.UpdateMonitorRequest", + **kwargs: Any + ) -> "_models.Monitor": + """Patches the Tags field of a SAP monitor. + + Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP + monitor name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param body: The Update SAP workload monitor request body. + :type body: ~azure.mgmt.workloads.models.UpdateMonitorRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Monitor, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.Monitor + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Monitor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'UpdateMonitorRequest') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Monitor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"} # type: ignore + diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py new file mode 100644 index 000000000000..47cc4820beb7 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Workloads/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +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: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: + """Lists all the available API operations under this PR. + + :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[~azure.mgmt.workloads.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.Workloads/operations"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py new file mode 100644 index 000000000000..c64555e444c5 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_php_workloads_operations.py @@ -0,0 +1,795 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/phpWorkloads") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + php_workload_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + php_workload_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + php_workload_name: str, + *, + delete_infra: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if delete_infra is not None: + _query_parameters['delete-infra'] = _SERIALIZER.query("delete_infra", delete_infra, 'str', min_length=1) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class PhpWorkloadsOperations(object): + """PhpWorkloadsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.PhpWorkloadResourceList"]: + """Lists PHP workload resources for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PhpWorkloadResourceList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PhpWorkloadResourceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/phpWorkloads"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.PhpWorkloadResourceList"]: + """Lists PHP workload resources in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PhpWorkloadResourceList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.PhpWorkloadResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PhpWorkloadResourceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/phpWorkloads"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any + ) -> "_models.PhpWorkloadResource": + """Gets the PHP workload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PhpWorkloadResource, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + php_workload_name: str, + php_workload_resource: "_models.PhpWorkloadResource", + **kwargs: Any + ) -> "_models.PhpWorkloadResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(php_workload_resource, 'PhpWorkloadResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + php_workload_name: str, + php_workload_resource: "_models.PhpWorkloadResource", + **kwargs: Any + ) -> LROPoller["_models.PhpWorkloadResource"]: + """Create or updated PHP workload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :param php_workload_resource: Resource create or update request payload. + :type php_workload_resource: ~azure.mgmt.workloads.models.PhpWorkloadResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PhpWorkloadResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.PhpWorkloadResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + php_workload_resource=php_workload_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + php_workload_name: str, + resource_patch_request_body: "_models.PatchResourceRequestBody", + **kwargs: Any + ) -> "_models.PhpWorkloadResource": + """Update PHP workload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :param resource_patch_request_body: Workload resource update data. + :type resource_patch_request_body: ~azure.mgmt.workloads.models.PatchResourceRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PhpWorkloadResource, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.PhpWorkloadResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PhpWorkloadResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource_patch_request_body, 'PatchResourceRequestBody') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PhpWorkloadResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + php_workload_name: str, + delete_infra: Optional[str] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + delete_infra=delete_infra, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + php_workload_name: str, + delete_infra: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete PHP workload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :param delete_infra: Whether to delete infra along with workload resource. Default value is + None. + :type delete_infra: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + 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, + php_workload_name=php_workload_name, + delete_infra=delete_infra, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py new file mode 100644 index 000000000000..c301c686d0fb --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py @@ -0,0 +1,620 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "providerInstanceName": _SERIALIZER.url("provider_instance_name", provider_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "providerInstanceName": _SERIALIZER.url("provider_instance_name", provider_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "providerInstanceName": _SERIALIZER.url("provider_instance_name", provider_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ProviderInstancesOperations(object): + """ProviderInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.ProviderInstanceListResult"]: + """Gets a list of provider instances in the specified SAP monitor. + + Gets a list of provider instances in the specified SAP monitor. The operations returns various + properties of each provider instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderInstanceListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.ProviderInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProviderInstanceListResult", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/monitors/{monitorName}/providerInstances"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + **kwargs: Any + ) -> "_models.ProviderInstance": + """Gets properties of a provider instance. + + Gets properties of a provider instance for the specified subscription, resource group, SAP + monitor name, and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param provider_instance_name: Name of the provider instance. + :type provider_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProviderInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.ProviderInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProviderInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + provider_instance_parameter: "_models.ProviderInstance", + **kwargs: Any + ) -> "_models.ProviderInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(provider_instance_parameter, 'ProviderInstance') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ProviderInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ProviderInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + provider_instance_parameter: "_models.ProviderInstance", + **kwargs: Any + ) -> LROPoller["_models.ProviderInstance"]: + """Creates a provider instance. + + Creates a provider instance for the specified subscription, resource group, SAP monitor name, + and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param provider_instance_name: Name of the provider instance. + :type provider_instance_name: str + :param provider_instance_parameter: Request body representing a provider instance. + :type provider_instance_parameter: ~azure.mgmt.workloads.models.ProviderInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProviderInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.ProviderInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderInstance"] + 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, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + provider_instance_parameter=provider_instance_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ProviderInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + monitor_name: str, + provider_instance_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResult"]: + """Deletes a provider instance. + + Deletes a provider instance for the specified subscription, resource group, SAP monitor name, + and resource name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Name of the SAP monitor resource. + :type monitor_name: str + :param provider_instance_name: Name of the provider instance. + :type provider_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + monitor_name=monitor_name, + provider_instance_name=provider_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py new file mode 100644 index 000000000000..f89d32b33f4c --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py @@ -0,0 +1,798 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class SAPApplicationServerInstancesOperations(object): + """SAPApplicationServerInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def get( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + **kwargs: Any + ) -> "_models.SAPApplicationServerInstance": + """Gets the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPApplicationServerInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPApplicationServerInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional["_models.SAPApplicationServerInstance"] = None, + **kwargs: Any + ) -> "_models.SAPApplicationServerInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SAPApplicationServerInstance') + else: + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional["_models.SAPApplicationServerInstance"] = None, + **kwargs: Any + ) -> LROPoller["_models.SAPApplicationServerInstance"]: + """Puts the SAP Application Server Instance. :code:`
`:code:`
`This will be used by service + only. PUT by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance. + :type application_instance_name: str + :param body: The SAP Application Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.SAPApplicationServerInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPApplicationServerInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional["_models.UpdateSAPApplicationInstanceRequest"] = None, + **kwargs: Any + ) -> "_models.SAPApplicationServerInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'UpdateSAPApplicationInstanceRequest') + else: + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional["_models.UpdateSAPApplicationInstanceRequest"] = None, + **kwargs: Any + ) -> LROPoller["_models.SAPApplicationServerInstance"]: + """Puts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance. + :type application_instance_name: str + :param body: The SAP Application Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.UpdateSAPApplicationInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPApplicationServerInstance or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPApplicationServerInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPApplicationServerInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResult"]: + """Deletes the SAP Application Server Instance. :code:`
`:code:`
`This operation will be + used by service only. Delete by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance. + :type application_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> Iterable["_models.SAPApplicationServerInstanceList"]: + """Lists the SAP Application server Instances in an SVI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPApplicationServerInstanceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPApplicationServerInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPApplicationServerInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPApplicationServerInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py new file mode 100644 index 000000000000..73eafd5806ba --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py @@ -0,0 +1,799 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class SAPCentralInstancesOperations(object): + """SAPCentralInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def get( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + **kwargs: Any + ) -> "_models.SAPCentralServerInstance": + """Gets the SAP Central Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Instance name string modeled as parameter for auto + generation to work correctly. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPCentralServerInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPCentralServerInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional["_models.SAPCentralServerInstance"] = None, + **kwargs: Any + ) -> "_models.SAPCentralServerInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SAPCentralServerInstance') + else: + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional["_models.SAPCentralServerInstance"] = None, + **kwargs: Any + ) -> LROPoller["_models.SAPCentralServerInstance"]: + """Puts the SAP Central Instance. :code:`
`:code:`
`This will be used by service only. PUT + by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Instance name string modeled as parameter for auto + generation to work correctly. + :type central_instance_name: str + :param body: The SAP Central Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.SAPCentralServerInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional["_models.UpdateSAPCentralInstanceRequest"] = None, + **kwargs: Any + ) -> "_models.SAPCentralServerInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'UpdateSAPCentralInstanceRequest') + else: + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional["_models.UpdateSAPCentralInstanceRequest"] = None, + **kwargs: Any + ) -> LROPoller["_models.SAPCentralServerInstance"]: + """Updates the SAP Central Instance. :code:`
`:code:`
`This can be used to update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Instance name string modeled as parameter for auto + generation to work correctly. + :type central_instance_name: str + :param body: The SAP Central Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.UpdateSAPCentralInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralServerInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPCentralServerInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResult"]: + """Deletes the SAP Central Instance. :code:`
`:code:`
`This will be used by service only. + Delete by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Instance name string modeled as parameter for auto + generation to work correctly. + :type central_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> Iterable["_models.SAPCentralInstanceList"]: + """Lists the SAP Central Instances in an SVI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPCentralInstanceList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPCentralInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPCentralInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPCentralInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py new file mode 100644 index 000000000000..68495b6fcbb4 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py @@ -0,0 +1,799 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class SAPDatabaseInstancesOperations(object): + """SAPDatabaseInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def get( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + **kwargs: Any + ) -> "_models.SAPDatabaseInstance": + """Gets the SAP Database Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param database_instance_name: Database Instance string modeled as parameter for auto + generation to work correctly. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDatabaseInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPDatabaseInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional["_models.SAPDatabaseInstance"] = None, + **kwargs: Any + ) -> "_models.SAPDatabaseInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SAPDatabaseInstance') + else: + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional["_models.SAPDatabaseInstance"] = None, + **kwargs: Any + ) -> LROPoller["_models.SAPDatabaseInstance"]: + """Puts the SAP Database Instance. :code:`
`:code:`
`This will be used by service only. PUT + by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param database_instance_name: Database Instance string modeled as parameter for auto + generation to work correctly. + :type database_instance_name: str + :param body: The SAP Database Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.SAPDatabaseInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional["_models.UpdateSAPDatabaseInstanceRequest"] = None, + **kwargs: Any + ) -> "_models.SAPDatabaseInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'UpdateSAPDatabaseInstanceRequest') + else: + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional["_models.UpdateSAPDatabaseInstanceRequest"] = None, + **kwargs: Any + ) -> LROPoller["_models.SAPDatabaseInstance"]: + """Puts the SAP Database Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param database_instance_name: Database Instance string modeled as parameter for auto + generation to work correctly. + :type database_instance_name: str + :param body: The SAP Database Server instance request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.UpdateSAPDatabaseInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPDatabaseInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResult"]: + """Deletes the SAP Database Instance. :code:`
`:code:`
`This will be used by service only. + Delete by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param database_instance_name: Database Instance string modeled as parameter for auto + generation to work correctly. + :type database_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> Iterable["_models.SAPDatabaseInstanceList"]: + """Lists the SAP Database Instances in an SVI. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPDatabaseInstanceList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPDatabaseInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDatabaseInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPDatabaseInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py new file mode 100644 index 000000000000..99f0b81d4481 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py @@ -0,0 +1,1122 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + sap_virtual_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class SAPVirtualInstancesOperations(object): + """SAPVirtualInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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: str, + sap_virtual_instance_name: str, + body: Optional["_models.SAPVirtualInstance"] = None, + **kwargs: Any + ) -> "_models.SAPVirtualInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SAPVirtualInstance') + else: + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional["_models.SAPVirtualInstance"] = None, + **kwargs: Any + ) -> LROPoller["_models.SAPVirtualInstance"]: + """Creates an Virtual Instance for SAP. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.SAPVirtualInstance + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPVirtualInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> "_models.SAPVirtualInstance": + """Gets an Virtual Instance for SAP. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPVirtualInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional["_models.UpdateSAPVirtualInstanceRequest"] = None, + **kwargs: Any + ) -> "_models.SAPVirtualInstance": + """Updates an Virtual Instance for SAP. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param body: The Update Virtual Instance for SAP request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.UpdateSAPVirtualInstanceRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPVirtualInstance, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'UpdateSAPVirtualInstanceRequest') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPVirtualInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResult"]: + """Deletes an Virtual Instance for SAP. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + 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, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SAPVirtualInstanceList"]: + """Gets all Virtual Instances for SAP in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPVirtualInstanceList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPVirtualInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.SAPVirtualInstanceList"]: + """Gets all Virtual Instances for SAP in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SAPVirtualInstanceList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SAPVirtualInstanceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPVirtualInstanceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SAPVirtualInstanceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/sapVirtualInstances"} # type: ignore + + def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start"} # type: ignore + + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResult"]: + """Starts the SAP System. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start"} # type: ignore + + def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional["_models.StopRequest"] = None, + **kwargs: Any + ) -> Optional["_models.OperationStatusResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatusResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'StopRequest') + else: + _json = None + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop"} # type: ignore + + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional["_models.StopRequest"] = None, + **kwargs: Any + ) -> LROPoller["_models.OperationStatusResult"]: + """Stops the SAP System. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP. + :type sap_virtual_instance_name: str + :param body: The Virtual Instances for SAP stop request body. Default value is None. + :type body: ~azure.mgmt.workloads.models.StopRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationStatusResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py new file mode 100644 index 000000000000..8f383ae2bc26 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_skus_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +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: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.SkusListResult"]: + """Lists all the available SKUs under this PR. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkusListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.SkusListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SkusListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SkusListResult", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/skus"} # type: ignore diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py new file mode 100644 index 000000000000..6d99c1b5dc38 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_wordpress_instances_operations.py @@ -0,0 +1,528 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + php_workload_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "phpWorkloadName": _SERIALIZER.url("php_workload_name", php_workload_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class WordpressInstancesOperations(object): + """WordpressInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.workloads.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 + + @distributed_trace + def list( + self, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any + ) -> Iterable["_models.WordpressInstanceResourceList"]: + """Lists WordPress instance resources under a phpWorkload resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WordpressInstanceResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.WordpressInstanceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WordpressInstanceResourceList", 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any + ) -> "_models.WordpressInstanceResource": + """Gets the WordPress instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WordpressInstanceResource, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.WordpressInstanceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + php_workload_name: str, + wordpress_instance_resource: "_models.WordpressInstanceResource", + **kwargs: Any + ) -> "_models.WordpressInstanceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(wordpress_instance_resource, 'WordpressInstanceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + php_workload_name: str, + wordpress_instance_resource: "_models.WordpressInstanceResource", + **kwargs: Any + ) -> LROPoller["_models.WordpressInstanceResource"]: + """Create or updated WordPress instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_name: str + :param wordpress_instance_resource: Resource create or update request payload. + :type wordpress_instance_resource: ~azure.mgmt.workloads.models.WordpressInstanceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WordpressInstanceResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.WordpressInstanceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WordpressInstanceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + wordpress_instance_resource=wordpress_instance_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('WordpressInstanceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default"} # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + php_workload_name: str, + **kwargs: Any + ) -> None: + """Delete WordPress instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param php_workload_name: Php workload name. + :type php_workload_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 = kwargs.pop('api_version', "2021-12-01-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + php_workload_name=php_workload_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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, pipeline_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.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default"} # type: ignore + diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py new file mode 100644 index 000000000000..74346da4a818 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_client_operations.py @@ -0,0 +1,459 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_sap_sizing_recommendations_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_sap_supported_sku_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_sap_disk_configurations_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_sap_availability_zone_details_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class WorkloadsClientOperationsMixin(object): + + @distributed_trace + def sap_sizing_recommendations( + self, + location: str, + sap_sizing_recommendation: Optional["_models.SAPSizingRecommendationRequest"] = None, + **kwargs: Any + ) -> "_models.SAPSizingRecommendationResult": + """Get SAP sizing recommendations. + + :param location: The name of Azure region. + :type location: str + :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is + None. + :type sap_sizing_recommendation: ~azure.mgmt.workloads.models.SAPSizingRecommendationRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSizingRecommendationResult, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPSizingRecommendationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPSizingRecommendationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if sap_sizing_recommendation is not None: + _json = self._serialize.body(sap_sizing_recommendation, 'SAPSizingRecommendationRequest') + else: + _json = None + + request = build_sap_sizing_recommendations_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.sap_sizing_recommendations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPSizingRecommendationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_sizing_recommendations.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations"} # type: ignore + + + @distributed_trace + def sap_supported_sku( + self, + location: str, + sap_supported_sku: Optional["_models.SAPSupportedSkusRequest"] = None, + **kwargs: Any + ) -> "_models.SAPSupportedResourceSkusResult": + """Get SAP supported SKUs. + + :param location: The name of Azure region. + :type location: str + :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. + :type sap_supported_sku: ~azure.mgmt.workloads.models.SAPSupportedSkusRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPSupportedResourceSkusResult, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPSupportedResourceSkusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPSupportedResourceSkusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if sap_supported_sku is not None: + _json = self._serialize.body(sap_supported_sku, 'SAPSupportedSkusRequest') + else: + _json = None + + request = build_sap_supported_sku_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.sap_supported_sku.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPSupportedResourceSkusResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_supported_sku.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku"} # type: ignore + + + @distributed_trace + def sap_disk_configurations( + self, + location: str, + sap_disk_configurations: Optional["_models.SAPDiskConfigurationsRequest"] = None, + **kwargs: Any + ) -> "_models.SAPDiskConfigurationsResult": + """Get SAP Disk Configurations. + + :param location: The name of Azure region. + :type location: str + :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. + :type sap_disk_configurations: ~azure.mgmt.workloads.models.SAPDiskConfigurationsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPDiskConfigurationsResult, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPDiskConfigurationsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPDiskConfigurationsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if sap_disk_configurations is not None: + _json = self._serialize.body(sap_disk_configurations, 'SAPDiskConfigurationsRequest') + else: + _json = None + + request = build_sap_disk_configurations_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.sap_disk_configurations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPDiskConfigurationsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_disk_configurations.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations"} # type: ignore + + + @distributed_trace + def sap_availability_zone_details( + self, + location: str, + sap_availability_zone_details: Optional["_models.SAPAvailabilityZoneDetailsRequest"] = None, + **kwargs: Any + ) -> "_models.SAPAvailabilityZoneDetailsResult": + """Get SAP Availability Zone Details. + + :param location: The name of Azure region. + :type location: str + :param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value + is None. + :type sap_availability_zone_details: + ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SAPAvailabilityZoneDetailsResult, or the result of cls(response) + :rtype: ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SAPAvailabilityZoneDetailsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-12-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if sap_availability_zone_details is not None: + _json = self._serialize.body(sap_availability_zone_details, 'SAPAvailabilityZoneDetailsRequest') + else: + _json = None + + request = build_sap_availability_zone_details_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.sap_availability_zone_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SAPAvailabilityZoneDetailsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + sap_availability_zone_details.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails"} # type: ignore + diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/py.typed b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloads/sdk_packaging.toml b/sdk/workloads/azure-mgmt-workloads/sdk_packaging.toml new file mode 100644 index 000000000000..e0654ca1938b --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-workloads" +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/workloads/azure-mgmt-workloads/setup.py b/sdk/workloads/azure-mgmt-workloads/setup.py new file mode 100644 index 000000000000..e92f017631fe --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/setup.py @@ -0,0 +1,78 @@ +#!/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-workloads" +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('-', '.') + +# 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', + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + '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', + ]), + include_package_data=True, + package_data={ + 'pytyped': ['py.typed'], + }, + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.3.0,<2.0.0', + ], + python_requires=">=3.6" +) diff --git a/sdk/workloads/ci.yml b/sdk/workloads/ci.yml new file mode 100644 index 000000000000..94b5fc091e01 --- /dev/null +++ b/sdk/workloads/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/workloads/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/workloads/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: workloads + Artifacts: + - name: azure-mgmt-workloads + safeName: azuremgmtworkloads